Does anyone know how to add "menu" text under the dots menu icons in action bar?
Also, how can I make my option menu items to display the icon in Android 4.0?
You can't add text under the default menu icon in the 4.0 Action bar, you do however have two alternatives
1) You can create your own icon that includes the text 'Menu' (Unfavourable)
2) Create a custom menu item with the dots image and the properties so that the text appears next to it.
android:showAsAction="always|withText"
Take a look at The Android SDK Documentation on Action Bar to see how to create custom items and make them perform tasks.
Related
I am trying to set image in overflow menu items like as in flipkart.But I am unable to set image.Can anybody provide me code snippet for doing this
If you are trying on Android 3.0+, it won't show icons in the menu items. Google has removed them in order to make the menu look similar on different apps. See icon in menu not showing in android and on Android Developers blog.
It is not possible to add icons in overflow menu item as per googles new change, If u still want, try this.
for device with overflow hardware button:
override hardware button click and show a transparent fragment with list view as like over flow menu in samsung devices(S3, s4) with icon.
for devices without hardware button:
use sub menu to look as menu. google still supports icon in sub menu.
That's how it's supposed to work.
If the icon shows in the action bar, it will only show the icon (with an optional title by using android:showAsAction="always|withText" or android:showAsAction="ifRoom|withText").
If the icon does not show in the action bar, it will only show in the overflow menu as text. Note that there is no "withIcon" enum value for the android:showAsAction attribute.
I am developing my first android app. I would like to add a dropdown menu to action bar. I used the second option described in this question, but I am not able to set the onItemSelectedListner. I am using the tab navigation, so I can't set the navigation to listview. How can I get this to work?
I am using the action bar in my app, and I have two qustions:
1 As the image below, the items(item 1,item 2, item 3) is displayed without icon, is it possible to show the icon?
In fact the icon is set in the menu.xml.
2 Is it possible to know if the action bar is split-ed?
I use android:uiOptions="splitActionBarWhenNarrow" to make the actionbar split-ed if necessary, but I want to know if it is split-ed in the runtime.
I have a problem with action bar and menu. I want to create drop down menu in action bar.I have icon which when I click on it I get drop down list with items where item have icon and title. Is there any standard icon in action bar or I need create something else?
Study these links link1
link2 Hope this will solve your problem
Add Menus items to your ActionBar and set android:showAsAction="never" , ActionBar will create a dropdown menu and display all your Menu items if there is no room on the standard action bar.
You can also change the style using android:actionDropDownStyle.
Read this
I am developing on a Galaxy Nexus, and I would like the settings icon on the main dock to open up some window of buttons. How do I go about handling this button press? it's that button that looks like a vertical "..."
That button:
will only appear on devices without a MENU button
will only appear if you have action bar items in the overflow menu
cannot be directly used for other purposes
You are welcome to have an action item in the action bar that will "open up some window of buttons". You can choose whatever icon you want for this action item. I strongly encourage you to not use the same icon as the action overflow menu. There are millions of possible icons, so surely you can choose one of greater relevance to whatever the "window of buttons" is and will not conflict with the users' expectations of what the action bar overflow should look and work like.