in my app the android default menu button is not visible? why? Any help?
Refer this:
On Android Honeycomb how do I add option menu to the home bar at the bottom of the screen?
And this:
onCreate Options menu is not showing in android 3.1
You can simple edit target SDK in manifest file to force use SDK of mobile rather than tablet like this:
android:targetSdkVersion="10"
Not only should your apps stop relying on the hardware Menu button, but you should stop thinking about your activities using a “menu button” at all.Your activities should provide buttons for important user actions directly in the action bar (or elsewhere on screen). Those that can’t fit in the action bar end up in the action overflow.
In order to provide the most intuitive and consistent user experience in your apps, you should migrate your designs away from using the Menu button and toward using the action bar.
Ice Cream Sandwich rolls out to more devices, it’s important that you begin to migrate your designs to the action bar in order to promote a consistent Android user experience.See this link
Did you hook up a xml menu file to your activity ?
#Override
public boolean onCreateOptionsMenu(android.view.Menu menu) {
getMenuInflater().inflate(R.menu.xmlfilename, (android.view.Menu) menu);
return true;
}
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 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.
until now I compiled my app with SDK for Android 2.1. There the options/preferences button appeared automatically, I only had to bring it alive by providing methods onPrepareOptionsMenu() and onMenuItemSelected().
Now i switched over to SDK for 2.2 and my whole layout is...hm...damaged. Most obvious problem: the options-button is gone.
So what do I have to do to re-enable it for 2.2?
Thanks!
There the options/preferences button appeared automatically
There has never been an "options/preferences button" in Android that "appeared automatically". I am going to guess that you mean the legacy menu affordance in the system bar/navigation bar on Android 3.0 devices, for apps with android:minSdkVersion set too low.
So what do I have to do to re-enable it for 2.2?
The legacy menu affordance has nothing to do with your build target. It has everything to do with your android:minSdkVersion. More importantly, your objective should be to get rid of this affordance, as it is a sign to users that your app is out of date.
If you are using onPrepareOptionsMenu(), you should be using the action bar, in which case your former menu items will either appear in the action bar directly as toolbar-style buttons, or in the action bar's overflow menu ("..." button), or via a popup menu that appears when the user presses their device's MENU button.
If you do not want the action bar, then do not use onPrepareOptionsMenu(). Instead, create your own menu structure using your own widgets as part of your own activity UI.
You can read more about the action bar and the vanishing menu affordance in the documentation.
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()
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.