I am developing an application with target Sdk 17. My current device is Nexus 7.
My app should be without an action bar so I am using the theme Theme.Holo.NoActionBar on the activity.
I want to show the overflow button (3 dots) at the bottom right (next to the recent task). but I can't make it to be visible. If I return the action bar I see it at the top right, but that's not what I want.
Is there any idea for anyone?
If you are talking about OptionsMenu button you must use ActionBar, or you can set android:targetSdkVersion="10" for your project in manifest file. This will enable compatibility behaviour and you will see menu button near other navigation buttons .
Related
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.
I know that I can the menu to be inside 3 dotted button on Android Actionbar by this way:
android:showAsAction="never"
But then, when I run it in Android 4.x, the 3 dotted button is not shown. Then I read the answer in this post:
The action overflow menu is only available when there is no hard menu
button available on the device.
He suggested to use ActionBarSherlock and use its ForceOverFlow theme but later there was an issue that need this theme to be removed.
Is there any other possible solution to force menu to be inside 3 dotted button on Android 4.x with physical menu button?
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.
How can I remove or hide the soft menu button in the bottom bar but still keep the overflow menu button in the ActionBar.
I have set the target API to:
android:targetSdkVersion="11"
as suggested here.
My app does have menu items so I am overriding the onCreateOptionsMenu().
The menu button appears both in the right side of the ActionBar and in a bottom bar. I simple don't want the space in the bottom of screen to be wasted for a duplicate menu button. I have seen apps like YouTube or Google Play which only have menu button in the ActionBar so I assume there should be a way to do this.
Raising target API to 14 (android:targetSdkVersion="14") solved this problem.
with thanks to CommonsWare
`
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.