How can I make a button act like a menu? - android

I am working on a simple application that is supposed to work on 800x480 tablet. Currently:
[][][][]
[][][][]
OOO
These are all buttons and they are working as expected. I, however, need to add menu items to the bottom-buttons. When clicked, menu items should pop up.
-Can I create a menu and place it at the bottom of the screen to replace those buttons? If so, could you show an example, cause I couldn't find any.
-Or, can I add menu items to these buttons?

What You want is an OptionsMenu, if I understand You the right way. I could give You an example later, I am not at home. But for now, look at this example. If You follow this, You donĀ“t need those buttons at the bottom.
http://www.edumobile.org/android/android-beginner-tutorials/options-menu/
if it is not clear, just let me know and I try to give You an example at the evening...
EDIT
for custom menu, You could use PopUpMenu. I had not tried this for now, but I think it is a good solution
http://android-er.blogspot.de/2012/03/example-of-using-popupmenu.html

Related

How do we show the options bar options vertically in android

I am using two option menus in my Layout. I am opening them with different button clicks using
openOptionsMenu();
I have 5 items in my options menu, when i call it, it pops up in Grid. ( table like click ) I want them vertically one on another, what should i do?
Got my problem solved from here http://www.codeproject.com/Articles/173121/Android-Menus-My-Way
Download the source code for complete understanding. cheers :)

How can I create a Menu group after clicking a button?

What I want to do, is to create a menu with checkeable items like this:
But just after clicking a button or icon in my main activity, so I can have different menus like this depending on the button which I click. I don't know if this is the right component or what I have to do.
I would just need a sample with a button and after clicking it, it creates this kind of menu with some options.
Thanks in advance.
There's several ways to accomplish this. One way would be to have a layout that you want to use for it and use a PopupWindow. This will create this type of look. You will just create the contentView to go inside it.
Another way, especially if you need more functionality, would be to create a separate Activity with a Dialog theme and put a ListView or whatever you need. But for what you have shown, a PopupWindow should work nicely for you

Menu that appears from above and below hides and shows on screen touch in android without using the menu button

Is it possible to create a menu in android that shows when someone for example touches a graph and It brings more options. I want a menu that will appear from above and below like how the menu used to be in android when you touch the menu button. Now without the button i would like the user to touch a chart or a table and two menus appear from above and below or even sides. Any suggestions will highly be appreciated
Suggestion:
Make the layout of menu you would like to show, and include it in the layout of your activity.
By default set it to be GONE, this will hide it.
Then set a touch listener for your graph, and change the visibility of menu to VISIBLE to show it.
I think what u need is a context menu; see this example Hope this helps :) cheers :)

How can i force an option menu to show up on android?

I have created an option menu for my app, but i want it to show up at the application start and be never hidden by any user control.
How can I? Is there a solution or i have to draw a custom menu in the layout?
How can I?
Don't make it an options menu. Use buttons or something.
If you want something to look like an options menu, please have it behave like an options menu, appearing when the user presses MENU and disappearing when the user makes a choice. Conversely, if you do not want it to behave like an options menu, then it should not look like an options menu, as that will confuse the user, wondering why your application or their phone is broken.
You have to place it in your layout.

android : set the menu out / visible

Maybe this question has been asked already but I can't find any information about that even in the "Menu" section of Android's doc...
So does anyone know if there is a way to set the menu out on an activity (to avoid the user clicking on the menu button of the phone)...?
Is this what you are looking for Sephy ?
Activity.openOptionsMenu()
I'm not quite sure what you are asking. The menu button is often a physical button on the phone, so you can't make it invisible if that is what you are asking. You can refrain from adding items to the menu. Then clicking the menu wouldn't do anything.

Categories

Resources