If I just need to change the Spinner popup Title bar background, what should I do? The only way is to make a customize spinner?
Yes, you have to create a custom spinner. The following link may help you to create it. change the spinner title bar style
Related
I'd like to change the style of this ActionBar Spinner below. It's all about changing the colours of the followings:
the selected text in spinner header (1. - currently gray)
spinner drop-down selected text (2. - currently white)
spinner drop-down non-selected text (3. - currently gray)
One more thing, it's generated with Android Action Bar Style Generator:
http://jgilfelt.github.io/android-actionbarstylegenerator/
Do you have any idea how can I do this?
Thanks in advance!
Try this programmatically :
spinner.setBackgroundResource(R.drawable.yourDesign);
spinner.setPopupBackgroundResource(R.yourDesign2);
This tool (Style Generator) is supposed to help only with the resources (images and xml's) to create custom action bars.
To change text colors, do it directly in the xml of the Spinner. Or, if you're using some kind of third-party component, change it via Java, with an Adapter and its specific configs.
By the way, this plugin is now deprecated. Consider using Toolbar or its support library equivalent.
I would like to use the Spinner as view-switching controller at Action Bar in my Android app, just like the native mail app (see part #2 at Android Common App UI).
So far I have managed putting the Spinner in the action bar and populating it with array of strings (see screen shot here) by looking at the example code at Android Developers.
My questions are:
How can I hide the activity name "MyAcitivity" from the action bar so the Spinner gets more place?
How can I make Spinner displaying two lines, one for the title and other for subtitle? Just like in the native mail app.
Why is the item text in the Spinner black and not white as the rest of the text in action bar?
I'm developing for Android version 4.0 and later.
How can I hide the activity name "MyAcitivity" from the action bar so the Spinner gets more place?
Call setDisplayShowTitleEnabled(false) on the ActionBar for this activity.
How can I make Spinner displaying two lines, one for the title and other for subtitle? Just like in the native mail app.
Create layouts that have more than one line in them that you use with your SpinnerAdapter.
Why is the item text in the Spinner black and not white as the rest of the text in action bar?
Probably you need to use getThemedContext() on ActionBar to get the Context to use with your SpinnerAdapter constructor.
1.How can I hide the activity name "MyAcitivity" from the action bar so the Spinner gets more place?
in order to remove this title you should edit the activity tag in manifast to android:label=" "
do this in every activity you wish for
3.Why is the item text in the Spinner black and not white as the rest of the text in action bar?
you can create style for the text color like theme.holo.light and apply this theme to your activity
1) How can I hide the activity name "MyAcitivity" from the action bar so the Spinner gets more place?
If you are using a standard theme, you can just look for the "noTitleBar" version and add it
android:theme="#android:style/Theme.Light.NoTitleBar"
FYI: check this link, it contains more detailed info
2) How can I make Spinner displaying two lines, one for the title and other for subtitle? Just like in the native mail app
I really dont get what you wanna do. If u need a text above and one below a spinning icon, you can just create a linear layout (a vertical one) adding inside of it the 3 elements
3) Why is the item text in the Spinner black and not white as the rest of the text in action bar?
You can modify every element in your layout by editing the style you are using.
FYI: basic theme in android
How do I adjust Spinner dialog style?
All I want to do is to change the background, either to drawable or a color.
If you want change the spinner's popup background, you can use : setPopupBackgroundResource()
For change background of the spinner (not the popup), this tutorial are good -> link
How to change spinner's dialog style ? I need to change background color from white.
Did you read the Android docs? If you go to http://developer.android.com/reference/android/widget/Spinner.html and do a CTRL+F search for color you should find what you are looking for
I would like to modify the background of the title bar of the dropdown dialog associated to a spinner.
If this is not possible I would like to know what resource is used to draw this background android.R.drawable.* ?
This is an effort of uniformity for my various pop ups in my application.
You can change everything using styles and themes.
Take a look at this example for buttons:
http://blog.androgames.net/40/custom-button-style-and-theme/