I am new to android.
How can i create option menu with out images like in the attached image? Do i need to use action bar or normal onCreateOptionMenu will do?
If you've developed your application for Android 3.0 (API level 11)
and higher, items from the options menu are available in the action
bar. By default, the system places all items in the action overflow,
which the user can reveal with the action overflow icon on the right
side of the action bar (or by pressing the device Menu button, if
available). To enable quick access to important actions, you can
promote a few items to appear in the action bar by adding
android:showAsAction="ifRoom" to the corresponding elements.
You can refer this doc for more detail.
Related
How create menu
https://www.google.com/design/spec/components/menus.html#menus-usage
The is PopupMenu or Spinnet?
The menu shown with the contacts is simply an Options menu as defined in the SDK.
Android will automatically position and manage your menu provided that you populate it in the activity.
If you've developed your application for Android 3.0 (API level 11) and higher, items from the options menu are available in the app bar. By default, the system places all items in the action overflow, which the user can reveal with the action overflow icon on the right side of the app bar (or by pressing the device Menu button, if available).
To enable quick access to important actions, you can promote a few items to appear in the app bar by adding android:showAsAction="ifRoom" to the corresponding <item> elements (see figure 2).
To add to a menu, see Activity.onCreateOptionsMenu
I have searched for Option menu and overflow Action menu, but did not get any difference in both.
Is there any difference or both are exactly same?
The option menu is used on Android 1.x/2.x devices, for apps that are not using an action bar backport (e.g., appcompat-v7).
The overflow menu in the action bar is used on Android devices that have an action bar, either the native action bar or a backport.
Menu items, such as those defined in onCreateOptionsMenu(), will go into an options menu on devices and apps that use it, or will go into the action bar on devices and apps that use one of those. Menu items not specifically designated to go into the action bar as toolbar-style buttons or other widgets will go into the overflow. Menu items that do not fit in the action bar will also go into the overflow.
Android uses the old options menu terms (e.g., onCreateOptionsMenu() instead of onCreateActionBarItems()) for backwards compatibility, so apps can be written to use the native action bar and still work, to some extent, on devices that lack an action bar.
There only exists one options menu. If the device has a menu key, then the overflow menu items appear when the key is pressed. On the other side, if the device has not menu key, then they appear on the action bar overflow icon.
I'm developing an android app which doesn't have an action bar. I have the sign out and sync options as menu items. When I tried this in my Nexus 5, the menu button is nowhere to be found. It usually appears in the action bar. Is there a way to keep the menu button and hide the action bar at the same time?
Is there a way to keep the menu button and hide the action bar at the same time?
No. If you are not going to use the action bar, you cannot reliably use <menu> resources. Please put "sign out and sync options" in your own GUI, such as via buttons.
Note that the MENU key is itself deprecated now; few devices going forward will have one.
I want to move the overflow button (that shows up the options menu) actually present in the top action bar to the bottom action bar. As actually done by Facebook application and many other applications. I want this for tablet only.
Screenshot:
Thanks.
First, neither of those screenshots show a "bottom action bar". They show the navigation bar.
Second, whatever is shown in your second screenshot is non-standard.
My guess is that second screenshot is supposed to be the legacy menu affordance. The objective of a modern Android app developer is to not show the legacy menu affordance, as it is an indication to users that your app is not being maintained. Modern Android apps have the overflow menu in the action bar (for devices without a dedicated MENU button).
That being said, if you wish to have fewer users, and therefore want to suggest to those users that your app is unmaintained, to have the legacy menu affordance, get rid of your action bar, such as by setting android:targetSdkVersion to 11 or lower.
You can read more about this in the documentation.
I'm using ActionBarSherlock in an app. The problem I'm having is that when the device is older and the action overflow is handled by the options menu at the bottom, I need to switch the icon to accommodate that. How can I tell if an action bar item is in the overflow or not? Is there a selector state I can use in the drawable for that?