Tag: android-actionbar

How To Center Icon in Android Action Bar

I’m trying to center the icon in the android action bar. I’m using a custom layout that has a button on the left side, an icon in the center and the menu options on the right. <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/ActionBarWrapper” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <ImageButton android:id=”@+id/slideMenuButton” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”@drawable/ic_menu_bookmark” /> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/RelativeLayout1″ […]

Full screen + action bar (Immersive)

Currently I am using low profile mode to hide the top black bar and dim the bottom nav bar. I want to use Immersive mode on Android but I’m having issues with the action bar. I would like to do Immersive mode sticky but keep the action bar where it should be. Is there no […]

Dynamic TextView on ActionBar

I need to implement a TextView in the ActionBar. This TextView shows the status of the bluetooth connection so it will update depending of this status. I’m not talking about changing ActionBar’s title, but adding a textview f.e. under the title or at the right side. At the moment, what I have done is create […]

How to code backward compatible new feature in Android SDK?

I want to use the actionbar feature included in SDK 11. However I also want the app to run on earlier devices from SDK 10 (2.3.3). I am willing to give up the actionbar feature for the earlier devices as it is not an important feature. I have done all the reading about reflection, wrapper […]

AppCompat Actionbar styling

I’m currently trying to use AppCompat instead of ActionbarSherlock. On Android 4+ devices I don’t run into any problems, as the normal Actionbar and Holo theme are used. On lower Android versions however, this weird look happens when using Theme.AppCompat.Light. The Actionbar is white and has a blue line underneath. I was able to fix […]

detecting a click on action bar back button -(OnOptionsItemSelected not calling when click on action bar back button)

I have an action bar containing a searchview. When user click on the search button and collapse the search view the action bar shows a back button on the left side. How can we detect when user click on this back button? Edit based on the answer I checked my OnOptionsItemSelected but it is not […]

ActionBarSherlock AndroidManifest.xml and other files missing on import

I’d like to try the ActionBarSherlock library, but no matter what I try either my project gets the red exclamation point, or sherlock gets the red exclamation point, or sherlock gets errors, or I get “[2011-11-09 18:59:29 – Library-ActionBarSherlock] AndroidManifest.xml file missing!”, etc… I constantly open, close, clean, “fix project properties”. I’ve tried it on […]

“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 […]

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