Last active
May 16, 2019 18:18
-
-
Save EduardoSP6/6cb69fc0e7ab6b54793f380e1ab56ad1 to your computer and use it in GitHub Desktop.
Android Spinner Style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1- Insert this code in styles.xml: | |
<style name="SpinnerStyle"> | |
<item name="android:background">@drawable/spinner_style</item> | |
</style> | |
2- Create a new Vector Asset called ic_arrow_drop_down_black_18dp with size: 18x18dp. | |
3- Modify file /drawable/spinner_style.xml like: | |
<?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:endColor="#EEEEEE" android:startColor="#EEEEEE" android:type="linear" /> | |
<stroke android:width="1dp" android:color="#DFDFDF" /> | |
<corners android:radius="4dp" /> | |
<padding android:bottom="1dp" android:left="6dp" android:right="6dp" android:top="1dp" /> | |
</shape> | |
</item> | |
<item android:gravity="right" android:drawable="@drawable/ic_arrow_drop_down_black_18dp" /> | |
</layer-list> | |
</item> | |
</selector> | |
4- In layout xml, on Spinner definition, insert this lines: | |
style="@style/SpinnerStyle" | |
android:layout_height="40dp" | |
=============================== End ==================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment