Android_programmer_camera
Android_programmer_camera

Reputation: 13359

Changing background color for items of Spinner

I am working on Android application.I am using Spinner control and added items to it. Is there a way to change the background color of items in spinner.
can any one help me in sorting out this issue.
Thanks in Advance,

Upvotes: 2

Views: 12075

Answers (3)

user2331869
user2331869

Reputation:

You can also use android:popupBackground="YOUR COLOR" which will define the items background not the whole spinner's background.

Upvotes: 0

Etienne
Etienne

Reputation: 1012

If you completely want to customize your background spinner, you should use 9patch background.

Here is a tutorial that explain how to do that : http://www.gersic.com/blog.php?id=57

Otherwise, the solution given by user432209 is the simplest. However, if you want to do that in xml layout :

<Spinner android:id="@+id/spinner"
         ...
         android:background="#YOUR_HEXA_COLOR"/>

Upvotes: 2

user432209
user432209

Reputation: 20167

You can use

yourView.setBackgroundColor(int color)

Upvotes: 2

Related Questions