Android 4.0, Text on the Action Bar Never Shows

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 this

getSherlockActivity.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:

  1. Reduce the icons by moving them either to an overflow menu or somewhere else in your UI.
  2. 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



Leave a reply



Submit