In my app I'm using a spinners to let the user select an item from a list. Everything works fine but I'm not really happy with the look of the spinner. As you can see in the image below it has the same design as a normal button.
What I want is a spinner which looks more like a normal text field. So I browsed a little bit through the drawable folder of the Android sources and found out that the spinner background should normally look quite different. I append an image of a spinner with the background image as I found it in the drawable folder. Although the spinner in the image is focused, I think you can see the difference between both spinners.
Now I'm wondering why the my spinner (first one) doesn't have the same design as the second one as II didn't changed any attributes which are related to the design of it. Where does this button like design come from?
The first spinner screen depicts the default spinner.
So the answer is that you've expected the wrong behavior. You can however create your own spinner look.
Looks to me that the second spinner was there in the earliest versions of the android sdk and just remains there as is.
Related
I want the spinner to open in a popup manner instead of the list manner which i am getting right now. I have tried changing the theme as well. The spinner worked in the popup manner in the lower version devices. What can i do?thanks in advance.
I want the opposite of what problem is discussed here Android: Change Spinner Dropdown view
On your xml file, set
android:spinnerMode="dialog"
on your spinner.
I created with Android Studio 1.0 a new project and added a spinner. But the result doesn't look very understandable. It's not clear enough that the spinner is a clickable object. It shows only the top element and a small arrow down. My default Spinner
I've implemented the spinner the way the developer-page from android describes.
How can I change it to something, that looks more like this.
I've tried things like setting the background color, but in the result the little arrow disappears.
How is it possible, that my default layout looks so different from the declared one by developer.android.com?
In any case you can create your own custom spinner or set some selector to it. For example: http://androidexample.com/Custom_Spinner_With_Image_And_Text_-_Android_Example/index.php?view=article_discription&aid=84&aaid=107
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.
How to customize android spinner like this, and also the item of spinner also will look like this width. Is it possible to do this? If yes means tell the way. Otherwise what will do?
You have to create 2 or 3 state 9 patch image for the selected, pressed and default state of the Spinner and then use them as background of the Spinner.
Have a look at this post which beautifully explain all the process.
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.