I want to change spinner look in android and I want it to be same for all the devices. I tried to do the same but failed to do so. If I use Tag, I am not able to customize it. I am adding screenshot of image of how I want.
http://prntscr.com/gb3oh9
You could share the adapter between different Spinner s if they adapted the same information. Clearly each of your adapters need to adapt a different set of String s, so you need to create an ArrayAdapter for each Spinner . A single OnItemSelectedListener will work for the 3 Spinners (as long as you set them).
Android Spinner is a view similar to the dropdown list which is used to select one option from the list of options. It provides an easy way to select one item from the list of items and it shows a dropdown list of all values when we click on it.
Try something like this:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<stroke android:width="2px" android:color="@color/darkgray_7" />
<corners android:radius="5dp" />
</shape>
</item>
<item>
<bitmap
android:gravity="right" android:src="@drawable/arrow" />
</item>
</layer-list>
</item>
</selector>
Try following code for custom Spinner
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item><layer-list>
<item><shape>
<gradient android:angle="90" android:startColor="@color/white" android:endColor="@color/appblue" />
<stroke android:width="1dp" android:color="@color/block" />
<corners android:radius="4dp" />
<padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp" />
</shape></item>
<item ><bitmap android:gravity="right|center" android:src="@drawable/drop_arrow" android:tint="@color/red" />
</item>
</layer-list></item>
</selector>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With