Issue while displaying action bar with title in android 4.0 or higher
may be there is no need to use title bar because action bar supports title feature
So you have to add just getSherlockActivity.getSupportActionBar().setTitle("some text");
have you tried thisgetSherlockActivity.getSupportActionBar().setCustomView(customNav);
getSherlockActivity.getSupportActionBar().setDisplayShowCustomEnabled(true);
Android 4.0 / ICS - App Icon on Action Bar not clickable
I found it in the documentation at http://developer.android.com/guide/topics/ui/actionbar.html:
Note: If you're using the icon to navigate to the home activity, beware that beginning with Android 4.0 (API level 14), you must explicitly enable the icon as an action item by calling setHomeButtonEnabled(true) (in previous versions, the icon was enabled as an action item by default).
button that is just text in action bar
Try to remove the android:icon
attribute from your menu XML :
<item android:id="@+id/my_id"
android:title="@string/my_string"
android:showAsAction="ifRoom|withText" />
Or try to use the Icon Generator
from here, chose the Text
tab and generate your icons with the provided text.
Android withText option does not work for action bar buttons on Huawei MediaPad (T1-A21L)
Long story short, it couldn't be done :)
Android ICS action bar buttons with text AND icon
You can look directly at the source. It uses a custom XML layout, which you can look at on the unofficial git mirror.
You can set the actionBar to use this view by inflating that view and calling a simple
context.getActionBar().setCustomView(customView);
Android: How to write text under the icon in the actionbar
'always|withText' only works if there is sufficient room. Else, it will only place icon. In your case, you've got several icons there which does not leave any spare room for text.
You've got two options:
- Reduce the icons by moving them either to an overflow menu or somewhere else in your UI.
- Design images which consist both icon and text and use them as your icons.
Edit: Well, here's a lot better answer: https://stackoverflow.com/a/12225863/2511884
Related Topics
How to Store Image Retrieved from Url in a SQLite Database
Using Intent.Action_Pick for Specific Path
Android Supporting Multiple Resolution with Multiple Layout Folder
Android Design Support Library Expandable Floating Action Button(Fab) Menu
How Can One Pull the (Private) Data of One's Own Android App
Configuration on Demand Is Not Supported by the Current Version of the Android Gradle Plugin
Android Sharedpreferences Limitations
Firebase Create User Without Sign In
Display Unity Scene as Sub View in Android Studio
How to Solve Nullpointerexception Error in Android
Android - Wake Up and Unlock Device
Android Studio Image Asset Launcher Icon Background Color