Can anybody please explain me about this? I couldn't find sufficient information in developer documentation. Is it also applicable when item is shown as action and long clicked on icon shows a toast containing title.
In short: it shows up when space is nice to be kept.
I took pictures on Galaxy S4 4.4.2.
The first picture is a landscape, having only three selection related icons, you can see that the condensed title is used there:
however if I don't supply the the titleCondensed
it uses title
and it clearly fits:
The full title
is used at any other places where space is not an issue, like the "tooltip" (long press on an action bar icon, internally called cheat sheet) or the overflow menu:
... and here's part of code I used (with 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 empirical observation, and hence probably incomplete, but I was curious, so here are the Android code points implementing the below:
Note the internal
package and these are from the framework not the support library!
MenuItemImpl.getTitleForItemView
returns the title based on prefersCondensedTitle
, which has three implementations:
ActionMenuItemView
: true
ListMenuItemView
: false
IconMenuItemView
: true
http://developer.android.com/guide/topics/resources/menu-resource.html
Simply put, the titleCondensed is the title you would like to show when the title string is too long for the device it's being showed on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With