I want to implement this kind of "pop up menu" in my app but I have no idea how it is called and therefore I can't do any research on how to do it.
This is the picture
I want this menu to have three options, right now I'm using AlertDialog and the buttons are right next to each other (positive, negative, neutral), but I'd rather use this kind of pop up menu since it can have more buttons and looks more professional.
I'm not asking for the code or anything, I just want to know how this menu is called so that I can do my research then.
What you are looking for is a Context Menu. There are two options, a floating context menu (like the one on your image), or the contextual action mode (shows the options on an ActionBar, like the GMail app for example).
You can choose which one is more appropriate for your app, but the official documentation states:
If you're developing for Android 3.0 (API level 11) or higher, you
should usually use the contextual action mode to present contextual
actions, instead of the floating context menu.
User Marcelo gave me an answer.
This is what I was looking for
Related
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.
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 create custom options menu as below and also want this to be available on all activities.
So far I am able to add options menu using onCreateOptionsMenu method, and setting its icons.
But have no idea how it can be inflated as shown in images.
After doing some google search found out one example . If can get more help on implementing custom options menu.
Neither of those are options menus. If they happen to be triggered by pressing a MENU button, then those apps are monitoring onKeyDown() for MENU button presses. This also means that their menus will not work on devices that lack such a MENU button.
I strongly encourage you to follow the Android design guidelines. I recommend that you start integrating an action bar and using action items and the action overflow area, perhaps leveraging ActionBarSherlock to support Android 2.x devices.
I feel stupid for asking: What are the drop menus on honeycomb apps called? I'd like to use them in my app but i don't even know where to start.
An Example from Google Music, notice the triangle in the corner:
Here it is opened:
I found the Menu, which appears in the top right. I don't think they are context menus which you usually see associated with long holding touches.
(I realize these images are from the website, but they are all over honeycomb apps too)
The action bar will display your Activity's options menu in the top right automatically, but PopupMenu might be what you're looking for. It lets you generate a simple popup menu anchored to any View in your UI. Inflate a menu resource into the Menu object returned by getMenu, set a listener to respond to the user making a choice from the menu and call the show method.
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.