Tag: android-actionbar

Android – Actionbar Sherlock – Search Filter

I am trying to implement Action Bar using ActionBar Sherlock. I have three Action Button one of which is a Search Button. On Clicking of the Search Button the Search input field should be displayed which i have already implemented. But i want it to take the full width of the Action Bar. Any idea […]

Converting an ArrayAdapter to CursorAdapter for use in a SearchView

How can I convert an ArrayAdapter<String> of static data into a CursorAdapter for using Suggestion Listener in SearchView? I have constructed the ArrayAdapter<String> from static data (allString) ArrayAdapter<String> searchAdapter = new ArrayAdapter<String>(context, R.layout.listitem, allString); and I use it for an MultiAutoCompleteTextView which works fine in devices with API level less than 11 MultiAutoCompleteTextView findTextView.setAdapter(searchAdapter); However […]

How to display both normal and split ActionBar?

I have more then a few ActionBar items, and I am using splitActionBarWhenNarrow option. Latest Gmail app also uses it. But it also have a custom item on upper right that shows the current number of unread emails. When I use splitActionBar it sends all my action items to the bottom. How can I send […]

Android Support Toolbar colorControlNormal color

I would like to set my spinner drop down color to white, whilst keeping the other elements in my theme the default color. Here is the situation: <android.support.v7.widget.Toolbar android:layout_height=”@dimen/action_bar_height” android:layout_width=”match_parent” android:minHeight=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:theme=”@style/ToolbarTheme.Base” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light”> <Spinner android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerVertical=”true”/> </android.support.v7.widget.Toolbar> And the style is: <!– My base app theme –> <style name=”AppTheme.Base” parent=”Theme.AppCompat.Light.NoActionBar”> <item name=”colorPrimary”>@color/primary</item> <item […]

How can I focus on a collapsible action view EditText item in the action bar (when it is expanded) and force the soft keyboard to open?

I am using Jake Wharton’s excellent ActionBarSherlock library and have a collapsible search action view. I want to popup the soft keyboard when the search action view is expanded. We can read a recommended way of doing this in a DialogFragment in the “Using DialogFragments” blog post by Google (altered a bit for readability). // […]

Why does my Activity extend ActionBarActivity?

I downloaded the latest SDK version and when I created a new Android project the MainActivity that automatically generated extends ActionBarActivity, but I want to extend Activity. public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean […]

Android: How do you hide Tabs in the ActionBar?

I need to temporarily hide the Tab objects I’ve defined for my ActionBar. There is no setVisibility method on Tab objects, so I’m at a loss as to how to accomplish this.

Setting splitActionBarWhenNarrow from Java on Android

I’m wondering if it would be possible to tell android to split the ActionBar only when I want it to, but on the same Activity. My use case is that by default, the actions I have on the bar are OK to be collapsed, but on a long click on an item, I enter an […]

Pressing menu button causes crash in Activity with no ActionBar

I’m a newbie in Android and working on my first app. I have the main activity with no ActionBar in it. And I don’t want to display any menu in that Activity. Everything is working just fine But when I press the menu button present in the device itself, it causes my app to force […]

Change Toolbar background color programmatically does not change Toolbar Title Background color

I´m trying to change the toolbar Background color programmatically by doing this: getSupportActionBar().setBackgroundDrawable(newColorDrawable(getResources().getColor(R.color.test_color_blue))); And this is the result: before: After: Some how the toolbar title still has the same background color as before. here is my toolbar xml: <android.support.v7.widget.Toolbar xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:gravity=”center_vertical” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light” app:theme=”@style/Theme.Toolbar”> And here is the Theme: <style name=”Theme.Toolbar” parent=”ThemeOverlay.AppCompat.Dark.ActionBar”> <item […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.