android - show menu button on galaxy nexus - android

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.

Related

3 dot/settings in top bar buttons

When in some apps, there are those 3 dots in the top right of the app, on the action bar (not the home buttons), which allow for more options. In my app I have on, but I do not know how to make it do a method when it is clicked. Do I use android:onClick="METHOD_NAME ? Or do I need to setup a button variable in my activity class and setup and onClickListener? I have already tried both but I may be doing something wrong.
That three dots are the menu in the action bar. They are always shown on devices without a menu key.
See also the documentation for more details.
Three dots are called Overflow(very aptly named) and to use them you need to use ActionBar which is the top long, horizontal bar showing icons, other buttons along with the Overflow button.
Now in some devices where there is no physical menu button you will always see Overflow button.
Go through Docs and tutorials related to ActionBar but keep one thing in mind that ActionBar is only available for devices with android above HoneyComb. For android devices below 3.0 such as GingerBread or Froyo you will have to use compatibility libraries, so that will be an additional task.
And most notable libraries for this purpose are ActionBarSherlock and AppCompat.

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.

Android action bar overflow

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.

Menu button - galaxy nexus

I want my application to present the default menu button within my Galaxy nexus.
However when I load my app it removes the menu button. I have tried programmatically to show the menu button: first it tried the OnCreateOptionsMenu but it doesnt run when my activity is being created. Then I tried to run the openOptionMenu() within the onCreate method of my activity but no good.
I want my application to present the default menu button within my Galaxy nexus
I am uncertain what "the default menu button" is.
If you have android:minSdkVersion or android:targetSdkVersion set to 11 or higher, the overflow menu button will appear on the right side of your action bar.
In most other scenarios, you should get the legacy menu button in the bottom navigation bar.
For more, please read this Android Developers Blog post.

On Android Honeycomb how do I add option menu to the home bar at the bottom of the screen?

I'm On Honeycomb (3.1) and my first problem is that I don't know what is the name of the bar at the bottom of the OS (appears in every application). I've seen some apps add options to this bottom bar (it has by default the back button the home button and the show active programs button, besides the watch, battery indicator and signal connection strength). When a certain program uses options it sometimes adds them to this bottom bar (it is usually seen as a grid-like icon next to the show active programs buttons, which you can click and a menu pops up.
I've described it as best as I can, but My question is simple: how can I create a menu like this on in my app?
Thanks for any help!
EDIT:
Ok, I've just read it's a compatibility feature. And it's not supposed to be there in an Android App.
I feel stupid...
I'm On Honeycomb (3.1) and my first problem is that I don't know what is the name of the bar at the bottom of the OS (appears in every application).
That is the "system bar".
I've seen some apps add options to this bottom bar
This happens automatically for applications that set up an options menu using onCreateOptionsMenu(). However, once the application switches to the Honeycomb look-and-feel (e.g., via android:targetSdkVersion="11"), the options menu moves to the action bar.
how can I create a menu like this on in my app?
Long-term, you do not want to do this, because it means that you will not have the action bar and will not look like you belong on Honeycomb, Ice Cream Sandwich, etc.
Short-term, simply do not have android:targetSdkVersion="11", and implement an options menu as normal.

Categories

Resources