I’d like to learn about spinner and how to change spinner text size and spinner text color.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In Android, Spinner is nothing but a combo box or list box.
It lets you viewing multiple items and allows you to select one item from the list.
Edit Your XML code like this
Your Java Class code should look like this
The Output will look like
This site gives sample screen shot with source code
http://www.androidpeople.com/android-spinner-example
Generaly we can’t edit the textsize or textcolor through simple adapter,in firstxml file we declare the spinner and firstjava file we find through spinnername.findviewbyid(id).we just create the custom adapter through xml file i.e firstly we create secondxml file in which we gives our requirements like textview,images etc. ,in textview we gives the textcolor and textsize then we create customadapterfile in java and we just inflate that xml file through layout inflater in our custom adapter and finally we pass that adapter in spinner.Your custom viewing spinner is created.
example for custom view where you set the textsize,textcolor and images also and many thing:-
In this a contact list is made and using custom adapter we inflate below xml file in
contactadapter file
xml file :-
custom adapter file:-
}
we assume that you create firstxml file in which spinner is defined,finally in firstjava file you just add the code for spinner where we pass the custom adapter: