Tag: android-actionbar

“Field can be converted to a local variable” message appearing when setting action bar colour

After setting the colour of the action bar, actionBarColor in private String actionBarColor = “#B36305”; gets highlighted yellow and a warning is returned for some reason. What can be done to get rid of this warning? Field can be converted to a local variable public class MainActivity extends AppCompatActivity { private String actionBarColor = “#B36305”; […]

ActionBarDrawerToggle animation

I’m using the ActionBarDrawerToggle from the v7 appcompat library in my app and have some troubles with the menu-to-arrow animation. According to the material design guidelines the navigation drawer should overlap the toolbar and the icon animation should not be used when opening the drawer as I understand. Why is the animation enabled by default […]

android action bar onNavigationItemSelected

I’m developing for android 3+ In my action bar i have a drop-down list(see how to hide/unhide the actionbar list on android 3? for the dropdown i intend). The problem is i need to do a certain action when the user selects something, but Android calls onNavigationItemSelected() as soons as it draws the view, so […]

how to set NAVIGATION_MODE_LIST on Toolbar new appcompat v7 21

Now all methods related to navigation modes in the ActionBar class, such as setNavigationMode()… are now deprecated. The documentation explains: Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. In my current application, there is a spinner on ActionBar. How do I apply […]

ActionBar setBackgroundDrawable() nulling background from Thread/Handler

I’m trying to change the background of the ActionBar from a Handler. The end goal is to pass the Handler to an AsyncTask, but for now even calling Handler.sendMessage() from a Thread results in strange behavior. Through the debugger I’m able to see that the Handler receives the Message and subsequently runs setActionBarBackground() through to […]

How to make the Action Bar SearchView fill Entire action bar?

I was trying to create an action bar search in my application, but in the expanded state the SearchView is not taking the entire action bar width( it is still showing other actions)! So, how to make the SearchView fill the full ActionBar Area (as in GMAIL app)?

Android 4.0 / ICS – App Icon on Action Bar not clickable

For some reason, when testing on my Motorola Xoom with Ice Cream Sandwich, the App Icon in the Action Bar is not clickable, even though I have implemented an event handler. This only occurs after changing the targetSdkVersion to 15. If it is 13 it is still clickable, even on ICS. Why is this happening […]

How to change the colour of ActionBar navigation tabs?

I have an ActionBar in an app, and it has navigation tabs embedded in it (not TabHost!). By default the tabs show as dark grey, with a thin blue line under all the tabs, and a blue marker on the selected tab. Which styles do I override to change those colours?

ActionBarCompat – how to use it

I’m trying to use ActionBarCompat on my own project. I’ve already opened the sample project (http://developer.android.com/resources/samples/ActionBarCompat/index.html), But I don’t know how to implement it on my own. I can’t find any tutorial of some kind. Should I make this project as a library? Can someone give me some directions, please.

Reset action bar after using SearchView

I’m using SearchView widget to enable searching in my app. After the initial click on the search icon, the SearchView widget expands into the search field and the “back” arrow is shown next to the application icon. If I click the application icon the action bar reverts to the initial state (no “back” arrow) and […]

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