Reputation: 6927
I have created a spinner which looks like
My layout file is:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/round_corners"
android:padding="7dip" >
<Spinner
android:id="@+id/select_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:prompt="@string/selectCity" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="14dp"
android:text="@string/City"
android:textColor="@color/dark_grey"
android:textSize="18dp" />
</RelativeLayout>
What I want is to make the background of the spinner transparent but still show the downward arrow. Is there any way that I can do this?
Upvotes: 1
Views: 9341
Reputation: 12717
You should create a slector and give that selector as background to your spinner
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/..." />
<item android:drawable="@drawable/..." />
</selector>
Upvotes: 0
Reputation: 21191
Create xml file and place it in drawable folder.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/slim_spinner_pressed" />
<item android:drawable="@drawable/slim_spinner_normal" />
</selector>
.
<Spinner ..... android:background="@drawable/selector_slim_spinner" ..... />
For more Information Check this Change Spinner Style In Android
Upvotes: 3