Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends
i want to set text color in spinner component how it is done ???
thank u ....
Posted

Check this out:
Android: Custom Spinners[^]
 
Share this answer
 
Add a customized spinner item

for example adding green text color and size of 25sp, add this element into /res/layout/ :

spinner_item.xml
HTML
<textview>
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:textSize="25sp"
    android:gravity="left"  
    android:textColor="#00FF00"         
    android:padding="5dip"
    /></textview>


And load the custom item into the adapter!

Java
mySpinner = (Spinner) findViewById(R.id.spinner);
	List<string> list = new ArrayList<string>();
	list.add("Romania");
	list.add("Mexico");
	list.add("Germany");
	list.add("United Kingdom");
ArrayAdapter<string> dataAdapter= new ArrayAdapter<string>(this, R.layout.spinner_item, list);
mySpinner.setAdapter(dataAdapter);</string></string></string></string>


Jorgesys
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900