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?
Related
I have created a fly-out (sliding) menu by an example.
In example author uses NoActionBar attribute for activity to hide action bar.
But in my app I want to use actionBar's tabs (tabbed control, tab navigation) for navigation (like in a third picture).
Also in first and second pictures we can see a fly-out menu with desired view (screens from vk android app). Theirs menu hovers above action bar and they use tab control!
Last picture is my app. There menu is under action bar.
So, my question is: How can I make fly-out menu that will hover above action bar? But not with hiding action bar, so I will have possibility to use actionBar's tabs (it is impossible with NoActionBar attribute).
]
UPD: Found nice example here https://github.com/Cheesebaron/SlidingMenuSharp
I recommend you looking into this example, it has all the needed information: https://github.com/chrisbanes/cheesesquare
Your problem is that you inflate your navbar "under" the main activity (I guess, in a fragment).
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 using Action Bar in my application to implement Tab Fragments. I am successful in it. But getting a small problem. I am in a need of a drop-down list at the Right Corner of the action bar and a search button. Please see the image:
You can see the red marked buttons that i need to show in Action bar and below the actionbar we have tab fragments. I am successful in generating the Fragments but getting problem in showing these buttons on Actionbar. Please help me
The overflow button is automatically generated but if you have a phone with hardware button it wont show up. You shouldn't try to force it to show up as it goes against ussual behaviour for people with phones that have a hardware button.
I'm trying to create an app, which consists of a login Screen and after the validation of credentials forwarding to Home Screen Activity.
In that Activity, I want to place a tab bar (e.g. Home, User etc) and on a selected item to show some menu items (e.g #Home, "What's New", "Products", "About Us").
I'm stuck at coding that main page with tab bar (which I can) but, I don't know what control/object should I add and code. Any kind of help could be an improvement for me.
For creating Attractive Tab / action menu items, you can try action bar sherlock library that nice to create Action bar and tab also.
Here is a Link for that, it comes with demo example
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.