I have a context option menu, that I need to re-arrange it in a specific order.
Every row of the option menu should contain only a single item, like Share to Fb, and Share to Twitter are now displayed.
Is it possible to make the option menu "Some warning text..." and "Logout" be on separate rows?
If You're using default options menu the answer seems to be 'no'. Android decides itself on placing options.
Probably, You might need to create custom options menu. Please, refer to this guide and this question already asked.
If you implement Custom options menu then you make static text. here is some reference link for Custom options menu ,http://www.codeproject.com/Articles/173121/Android-Menus-My-Way
Related
I'm trying to set up a menu that appears when the user starts the app for the 1st time, so they can set it up by choosing from 1 of 6 items. It needs to start automatically dependent on a boolean value taken from sharedPreferences.
I have been trying to create a context menu, but its not working and I'm not sure if its the right way to go about it.
Has anyone done this and is context menu the right way to go? If not, please could you point me in the right direction.
Many thanks
You shouldn't be using a ContextMenu for this kind of design. You should be using a Custom Dialog for the configuring of your app. Using perhaps a ViewSlider to allow multiple configuration screens or just one View with all the configuration options in a ScrollView.
I want to build a menu similar to what you see when you go to Home->Menu->Settings->Display.
The menu there has sub menus, dialog popups, check boxes, and items that seem to launch other programs (like the calibration options). Anyway, what is that type of activity called? Is it just a listview? My app doesn't have anything to do with the android display settings. I just need that type of "advanced" controls.
It is a PreferenceActivity. Android controls the layout for you there.
When there's more than 6 items in the Android Option Menu, a "More" will be in place. My question is currently I see two different behaviors upon clicking, from different apps. One will show a menu like this, another will show a context menu like this.
Which is one is the proper Android way?
Thanks
I don't see how those two are related. Your first link shows the options menu with "more", which is what you were talking about in your first sentence. The second link shows the context menu after a long press on a list item - that's a completely different item. They both have their uses.
The menu is used for options that are global to the current activity. The context menu is intended for options that relate to the specific item you picked.
If you see an app that uses a context menu for "more", then it's not using the normal Android menu system. I've even seen Google apps use that (Maps, I believe), and I don't know why you would do that.
The first is the "proper" way as in the default behaviour you get. I don't think the difference is meaningful, but to achieve the second the coder must have mucked around, and I don't think it's worth it..
When I enter some text and press and hold on it then context menu is presented with items like cut,copy,select text and so on.
Is there any way to add my own custom item to this context menu ? I do not how this things works but I guess that should be possible to register something in the manifest just like registering activities and broadcasts . . .
Thanks,
Any ideas are wellcomed
Is there any way to add my own custom item to this context menu ?
Only for widgets in your own activities, not for the system as a whole.
Also, EditText is problematic even for your own activities, as some device manufacturers are bypassing the normal context menu system, so you can't add to them.
That being said, for your own activities, just follow the instructions to create a context menu for the widgets of interest.
Have you tried putting an onLongClickListener on your EditText? This won't let you add to the current list, but you can make your own dialog show up and then add all the options above, or some of them, or none of them and your own.
I'm not sure if exactly what you're asking for is possible, and if it is my way is a little bit more work, but you'll have full control.
I have a menu for about, exit.
But i need to create another static menu for options.
I will prefer to be at the top of the list that i have.
like:
Create, Edit
List
and when i press the menu button to open the (Exit,About).
If You can help, it will be perfect.
Thank you , have a good day.
Please see this post, and this one. The second post has nothing to do with what you want, it's just a nifty way to spruce up your UI by adding a QuickAction. The first post shows you how to build an "ActionBar" for Android.