Android action bar overflow - android

I was reading this article, and was surprised to read that:
You might notice only 2 of the 3 original menu items are displayed in
the new action bar [...]. To get the other menu items, you must go to
the "overflow menu".
The reason why I'm surprised is that when I do the same thing using an emulated Nexus (ie: no menu button) running on Android 4.1.2, then the overflow button does not appear in the menu, but directly in the action bar.
Any idea why the behavior is different ?
Note: in my AndroidManifest.xml, I'm using minSdkVersion="11"

The button which appears in the naviagation bar for devices which lack physical buttons isn't the overflow button; it's the legacy menu button. The behavior you are seeing is the correct, expected behavior.

Related

How to show menu item icons using Action Bar Compat (api 8+). Are not shown

Using Action Bar Compat support library, I have noticed that the settings menu (3 dots) does not show the icons with each item. The xml is correctly configured (android:icon="#drawable/ic_item") but the problem occurs running my app with emulator (v2.2) and real device (v2.2).
The contextual menu only displays the text items without their icons.
However, if I run the app in a real device with v4.0+, the icons are shown correctly with the text items of the contextual menu.
Any idea to solve it?
Thanks.
Overflow menu does not have icons by design by Google. This is the proper (or at least standard) way for it to behave.

How to add an action flow button on the navigation bar?

From the article "Say Goodbye to the Menu Button "
it seems now the menu button is going to the action bar.
"If you’ve already developed an app to support Android 2.3 and lower,
then you might have noticed that when it runs on a device without a
hardware Menu button (such as a Honeycomb tablet or Galaxy Nexus), the
system adds the action overflow button beside the system navigation. "
But since I do not want the action bar takes the space, and I only need one menu button there, I hope I had a menu button within the navigation bar at the bottom.
How to do that?
[Update] From one aplication's code, it seems if I set the target level is lower, and use the add menu function, the menu button can be put with the navigation bar at the bottom. But anyway, as Samus Arin said, if there is only button for the menu, it doesn't make sense to build a action bar.
You can develop for newer releases, and then detect if there is a menu-button on the device. If there is not, show your own in the UI.
http://developer.android.com/reference/android/view/ViewConfiguration.html#hasPermanentMenuKey()
Ex.
if(ViewConfiguration.hasPermanentMenuKey(context)){ Has menu-button } else { Does not have menu-button, show in UI }
As you said, if you want the overflow-button in the navigation-bar you have to set the target-sdk to 13 or lower.
IMO this option should be given to the developer regardless of targetsdk.
UPDATE: hasPermanentMenuKey() can only be used in SDK>13, so you have to check this manually in your code.

How to move the overflow (that shows the options menu) button in tablet top action bar to the bottom bar?

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.

Actionbar (Navigation bar?) vs menubutton

I have an application which runs full-screen and relies on the menu button. What I didn't realise is that devices like the Galaxy Tab use an actionbar which no longer has a menu button. My app currently loads a fragment displaying a settings menu when one touches the menu button:
#Override
public boolean onPrepareOptionsMenu(Menu menu) {
FragmentManager lFM = getSupportFragmentManager();
SettingsDialogFragment lSettingsDialog = new SettingsDialogFragment();
lSettingsDialog.show(lFM, "Settings");
return false;
}
I understand it is possible to add a custom icon to the action bar which when pressed could result in the same behaviour as a menu button. What I am unsure about is how to implement this.
How do I know that a device doesn't have a menu button and I need to add an icon to the action bar? It can't be as easy as checking the SDK version as apparently the actionbar was introduced in honeycomb, but my Galaxy Note runs ice cream sandwich and doesn't have an action bar (it still has a menu button). I don't want to give up any real-estate so adding buttons or menu options to my main layout isn't an option.
I just read on google developer that:
Navigation Bar New for phones in Android 4.0, the navigation bar is
present only on devices that don't have the traditional hardware keys.
It houses the device navigation controls Back, Home, and Recents, and
also displays a menu for apps written for Android 2.3 or earlier.
So I tried setting the target version on my app to 8. Instead of a menu I get a button allowing me to change the screen size of my app - but no menu button.
I have an application which runs full-screen and relies on the menu button.
That has been a bad idea for two years.
What I didn't realise is that devices like the Galaxy Tab use an actionbar which no longer has a menu button.
Such devices have been around for two years.
My app currently loads a fragment displaying a settings menu when one touches the menu button
That was never an appropriate design move. Please allow the MENU button, where it exists, to behave normally, displaying an options menu on Android 1.x/2.x and triggering the action bar overflow on Android 3.0+.
How do I know that a device doesn't have a menu button
http://developer.android.com/reference/android/view/ViewConfiguration.html#hasPermanentMenuKey()

android - show menu button on galaxy nexus

i need to have the menu button shown for some activities on galaxy nexus .
i can't find how to do that, since it hides it by default . i don't wish to create an action bar since it takes more space that i want to use to other things .
when setting the "android:targetSdkVersion" value to lower than 14 , it seems to show the menu button , but otherwise, it hides it .
btw, the activity needs to be full screen , with no title/action bars .
it is very weird that this button is not shown by default for so many places (even the launcher) , and on some places it does exist . such a button is a very basic one for so many android devices . google decided that not only that , but instead , the switching button is more important to be shown and it's shown by default (no idea if it's possible to hide it, but i guess not , since home button no longer does anything when long pressed) .
anyway, please help me . i'm quite new on android 4 .
The Menu button has been deprecated in ICS. Your options are 1) run in legacy mode (targetSdkVersion < 14), 2) use an action bar with or without an overflow menu button, 3) add a menu button somewhere in your app area. 4) not using a menu and just adding its actions directly to your app area.
The menu button is more of a legacy thing on newer Android phones with bigger screens since it's normally best to use the Action Bar (1) to provide the user with the actions that would normally be on the menu. These are called "Action Items" and are a better user experience because they appear directly on the Action Bar rather than requiring the user to tap the menu button.
(1) http://developer.android.com/guide/topics/ui/actionbar.html
targetSdkVersion no longer influence the visibility of the legacy overflow menu button on newer devices and OS, it's dead and buried.

Categories

Resources