Tag: android-actionbar

Android – NullPointerException on SearchView in Action Bar

I’ve got a problem trying to add a SearchView widget to the ActionBar in my activity – I get a null value when calling getActionView to get my SearchView object. I’ve been following the Android Developer guide and also went through a ton of SO questions as well as some other links on the Internet; […]

Put a progressBar on ActionBar

I am trying to put an indeterminate ProgressBar on the actionBar. I was using an actionView to put the progressBar like Google+ app for example. <item android:id=”@+id/menu_progress” android:actionLayout=”@layout/action_progress” android:menuCategory=”container” android:showAsAction=”always”> </item> the problem is that the progress bar is considered as an item and therefore on a Nexus S portrait mode I have only one […]

Custom Translucent Android ActionBar

I’ve been scouring the interwebs (e.g. Android documentation, answers here, etc.) for the answer to what I thought would be a fairly trivial question. How do you achieve a translucent action bar like the ones in Google Music and YouTube (links are image examples)? I want video content to be full screen and not constrained/pushed […]

Action Bar icon size

According to Action Bar Icons action bar icon for the mdpi screen should be 24 x 24 px but the icons in Action Bar Icon Pack for mdpi are 32 x 32 px. The sizes do not match for other screen sizes neither. So which one is correct and what dimensions should the action bar […]

Android Navigation Drawer on top ActionBar

I’m trying to make the navigation drawer over the action bar when it was slide to the right like this app: [Removed] This is my main activity’s layout: <?xml version=”1.0″ encoding=”utf-8″?> <android.support.v4.widget.DrawerLayout …> <RelativeLayout android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> … </RelativeLayout> <fragment android:name=”com….” android:layout_gravity=”start” android:id=”@id/navigation” android:layout_width=”@dimen/navigation_menu_width” android:layout_height=”fill_parent” /> </android.support.v4.widget.DrawerLayout> Some other questions on stackoverflow are similar such […]

How to fix getActionBar method may produce java.lang.NullPointerException

I am using a toolbar as my actionbar in an activity. I am trying to add the method getActionBar().setDisplayHomeAsUpEnabled(true); to the Activity.java file for Up navigation for older devices. The method produces the following error message in Android Studio: Method invocation may produce java.lang.NullPointerException The Up navigation on the toolbar works fine on newer devices…now […]

Should we replace Action Bar by ToolBar?

I have been using ToolBar since it was added into Support v7 library. And I think I used it well. But there is a point I can’t understand. Why would Google create such a widget? I mean we can do anything ToolBar can do by using ActionBar. Why do we have to use ToolBar? What […]

Menu Items are not showing on Action Bar

I have made a completely new project. I have added items to the menu layout file. Those items do not show up on the action bar’s right side. I remember that an icon with three dots shows up which opens up the menu. Here is my Activity public class MainActivity extends Activity { @Override protected […]

Change icons in ActionBar dynamically

I have an Activity which has an ActionBar but I need to change the icons on the ActionBar dynamically, I have a pause and a play button and I need to replace the play button with the pause button as the user click on it. I have searched and I found it: @Override public boolean […]

How to style the menu items on an Android action bar

There’s been many questions on styling on action bars, but the ones I’ve found either are relating to styling the tabs, or have answers that don’t work for me. The question is really quite simple. I want to be able to change the text styling (even just colour) of the menu items in the action […]

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