Android: How to write text under the icon in the actionbar - android-actionbar

I would like to write under the text in the action bar so i use this xml:
<item
android:id="#+id/Home"
android:icon="#drawable/ic_action_home"
android:showAsAction="always|withText"
android:title="home"/>
<item
android:id="#+id/Refresh"
android:icon="#drawable/ic_action_refresh"
android:orderInCategory="100"
android:showAsAction="always|withText"
android:title="refresh"/>
although i write:
android:showAsAction="always|withText"
this what i get :
How could I write text under the icons ?

'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

Prevent menu text from ellipsizing

I have a fairly straightforward menu that I am showing in an Activity, but some of the menu items have text that is too long to fit on screen. The default behavior for menus appears to be ellipsizing the text, as shown below.
Menu XML that I'm inflating in onCreateOptionsMenu():
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+id/menu_too_long"
android:title="This text is a tad too long"
android:icon="#drawable/ic_glass_logo"/>
</menu>
Is it possible to get the menu item text to adjust its size or wrap to a second line when it is too long? In other words, I would like menus inflated from XML to behave more like CardBuilder.Layout TEXT.
I would like to avoid creating my own menu and continue using Glass's built-in menu APIs.
Changing the formatting of the menu labels is not possible through public APIs. From a UX point of view, menu labels longer than two or three words seems undesirable. Consider that if you enable voice menus in your application, those commands should be brief that the user can speak them conveniently.
If the length of your menu text is because there is supplemental information that you can separate from the "action" that the menu performs, consider using MenuUtils.setDescription to move the supplemental information into the footer of the menu item, which can hold more content. You can call this method from within onCreateOptionsMenu or onPrepareOptionsMenu.

Android action bar 'overlay'

Im working on an android application that uses an action bar - which all works well.
One thing I would like to do is to display the 'underscore' of the icon that has been selected - I believe a kind of a graphic overlay so that the user knows what section they are in. This has been done in many apps but I'm not sure if its possible with the action bar .
This image shows a bar under the home icon in use on the twitter app, can it be done?
Overlaying action bar provide great effect on layouts,
Use android:windowActionBarOverlay for name keyword in item tag
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
</style>

Change ActionBar tabs color

I am using the appcompat support library and I want to change the color of the action bar tabs. I found these instructions in which the customize tab indicator section suggests creating a file res/drawable/actionbar_tab_indicator.xml declaring a specific background image for several different states of an action bar tab.
actionbar_tab_indicator.xml looks like :
<!-- STATES WHEN BUTTON IS NOT PRESSED -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false"
android:state_pressed="false"
android:drawable="#drawable/tab_unselected" />
...
The #drawable/* images are nine patches.
However, i do not want to get involved in creating nine-patches images. Is there another way to change the actionbar tab's color?
I wrote an answer to that question 1 year ago.
You can find in here:
Change Color TabSelector on v4 ViewPager

How can I enhance my usage of a menu layout?

How can I create a settings menu for my application that let's me show more information about the current status? With the menu layout it appears that I can only set these attributes:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="#+id/bot_engine"
android:title="#string/menu_settings_bot_engine" />
<item
android:id="#+id/text_to_speech"
android:title="#string/menu_settings_text_speech" />
</menu>
And It displays as follows:
But I want something like this:
This is how Google Glass display It's settings menu.
I want the user to be able to tab over the settings to toggle them between (Active/Inactive), displaying a message:
Active (In green) or Inactive (in red).
How can I do that?
The GDK menu works in the same way as the android context menu's on a phone.
It's designed for simple menus with just text and an optional icon. If you want to do something more complex (Like the glass settings) you would need to use a CardScrollView and add your own cards to it, then you can have as much flexibility as you like.
Hope that helps.

Is there any other control like ListView in win32 or if there is any way to remove the title area of the ListView control which is available in win32

Is there any other control like ListView in win32 or if there is any way to remove the title area of the ListView control which is available in win32. And can this be used for text formatting like tabs and bold, italics.
Thanks in advance :)
If you want text-like features then use rich edit control.
If you want to show list view control in report view without header then include LVS_NOCOLUMNHEADER style when creating the control.
yes, the column header doesn't have to be visible at all. It can format each item individually too like bold, but tabs are best implemented as columns (without the header visible of course).
Without knowing more what you want, its difficult to advise.