style a ListView as a standard ContextMenu - android

I am wondering where the default ContextMenu style is defined... to copy/use it!
I have few ListView in my app, using the provided TexView layout android.R.layout.simple_list_item_1. My listings are looking odd (black background) compare to the default ones like the ContextMenu (white background).
So if you know where it is, or how to make my ListView having a "standard" style, I would be glad to know about it ;)
Thanks
jo

I think the Context Menus look identical to the regular Options Menu. And those menu items are setup with a layout found at:
$(SDK_ROOT)/platforms/android-$(API_LEVEL)/data/res/layout/menu_item.xml.

Related

advanced Android menu

Hi Everyone
I'm new in android and i'd like to do a menu for an application.
I want to replicate the menu style of this game that has different section
http://i.giphy.com/l4Jz4PbvjJEZHZn8c.gif
I have 3 different xml layout that i want to show in my horizontal style menu capable of swiping from a layout to another.
I have heard i could use something called horizontal ListView but i don't really know how to use it.
How do i do?
try Sliding tab Layout. Its the same function just need to edit the codes for different design

Add separators and icons to android actionbar popup menu

I'm try to customize my app popup menu adding separators and icons.
Basically I would like to obtain a menu like this (from Google Photos app):
How can I achieve this?
Thank you all in advance :)
I dont think there is a straightforward way to add separators and icons to popup menu.
I suppose, you have to use PopupWindow. Using PopupWindow, you have to design the layout. So you can design it the way you want, like having icons and separators. But the catch here is, you have to position the PopupWindow using x,y and gravity parameters, and also the fade-in animation.
https://developer.android.com/reference/android/widget/PopupWindow.html
you can use multiple row in listview to obtain the design,
look at this example: http://www.survivingwithandroid.com/2014/08/android-listview-with-multiple-row.html

Android Contextual menu (similar to music app)

I would like to create a contextual menu for a listview similar to the one used by the google play music app in the listviews. (see screenshot. The triangle buttons open the menu for the album. and then one can select different options depending on the selected item.) But I've also seen this element in other apps.
https://lh5.ggpht.com/IvSpTcmdyUOC9GoX-x528xAzy9jEPjWCLcNcru4CBEcUNZ-YHo0y2TQHcGmuvOQ2zg
The Problem is that I neither know how to implement the triangle button correctly (is that just a normal imagebutton?) nor do I know how to open that popup window for each entry.
One approach I tried was using a spinner. But the problem is that the spinner always was as wide as the longest element in it and not just the triangle. Otherwise this would be a good solution. Is there a way to set the spinner to a smaller size and hide the horizontal line beneath it?
Or would a spinner be the complete wrong approach and I should solve this problem differently?
You should be using a Button or an ImageButton to trigger the PopupMenu. You could use Android Holo Colors to create the background image. Alternatively the Holo default spinner background should do the trick, too.
When the Button is clicked you should trigger a PopupMenu. The Android PopupMenu is for Android SDK API 11+. So if you're about to support lower versions you should consider external libraries like HoloEverywhere.
The Spinner Widget is not suitable for your purpose.
I have not really used the Music app before, but I would try to answer the question from what I understand from the screenshot. It seems to me that options that come up are presented in a simple Dialog. This dialog has a list that can be easily implemented as given here.
SO, what you can do is include a Button, or ImageView, or ImageButton or any other View in the list item and clicking on that will display the dialog.

Action Items with dropdown menu view

I want to create something similar to this picture where you select the action view and it brings up a dropdown list of items, is that just a submenu of the menu item or something else?
The easiest way to do that is probably to bundle in the GreenDroid library and use their solution: https://github.com/cyrilmottier/GreenDroid
Although this could also be accomplished with a basic LinearLayout containing a few buttons.
My guess id that you could do it with a new activity with the options. Normal dialogues are created this way. Then use the adequate layout to make it look like this. You can get the sources for the Option dialogue from the android source code and then style it accordingly.
Hope it helps.
It's looks like just a Spinner as ActionView with it's own adapter.

Listview theming issues

This is probably a simple question, but I really have tried searching here and google with no joy.
I can make listview lists by following the many tutorials on the net. The problem is, they always seem to churn out lists that don't seem similar in appearance to the bulk of the lists I see in apps.
For example, I've attached a screenshot of a menu in the Chainfire3D app. It uses the 'standard' blue dividers, white titles and smaller blue 'description' text for the second line. This style of menu/list is used in many of the market apps I have. Feedly is another example.
Every time I create a listview I get either all white text (or text which is themed by whatever I have used in the layout).
Are there 2 line menus, with white and blue text that are easy to create, because I'm having to specify the colours in XML etc if I want them to look this way.
Also, to get two line listviews I have been using a custom adapter and 2 textviews on top of each other in a layout. I tried a 'simple_list_item_2' and that worked but again it didn't take this 'standard' theme. I'm sure I'm missing something.
Anyone know what?
Ideally, can someone share some code with me that will create a 2 item listviews, ideally (if poss) with a suitable adapter that will allow the running of different activities based on menu items presses. Here's hoping you can help.
The easiest way is to customize your layout.
You can find good examples here or here.

Categories

Resources