Where is there android: titleCondensed attribute applicable in menu
In short: it appears when space is pleasant to store.
I took pictures with Galaxy S4 4.4.2.
The first photo is a landscape with only three icons associated with the selection, you can see that a condensed name is used here:
however, if I don't put it titleCondensed
, it uses title
and it clearly fits:
Full is title
used in any other places where space is not an issue, such as a "tooltip" (long press on an action bar icon, internally called a bypass sheet ) or an overflow menu:
... and here's some of the code I used (c appcompat-v7
):
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- Possibly more items like "Edit Item" and "Delete Item" below -->
<item android:id="@+id/action_select_all"
android:icon="@drawable/ic_action_select_all"
android:title="Select All"
android:titleCondensed="All"
app:showAsAction="ifRoom|withText" />
<!-- Same for Select None <-> None -->
<!-- Same for Invert Selection <-> Invert -->
</menu>
All of the above is an empirical observation and therefore probably incomplete, but I was curious, so here are the Android code points implementing below:
Note the package internal
, and this is from the framework, not from the support library!
-
MenuItemImpl.getTitleForItemView
returns a header basedprefersCondensedTitle
, which has three implementations:- Action bar icon and text
ActionMenuItemView
::true
- Possibly action bar overflow
ListMenuItemView
::false
- Old style options
IconMenuItemView
::true
- Action bar icon and text
source to share
http://developer.android.com/guide/topics/resources/menu-resource.html
In simple terms, titleCondensed is the title you want to show when the title bar is too long for the displayed device.
source to share