There is a style Spinner found in the internet. How does he round the corners and make the triangle red? It is necessary that the corner radius was 4dp

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <color android:color="#fff" /> <corners android:radius="40dp" /> </item> <item android:gravity="center_vertical|right" android:right="8dp"> <layer-list> <item android:width="12dp" android:height="12dp" android:gravity="center" android:bottom="10dp"> <rotate android:fromDegrees="45" android:toDegrees="45"> <shape android:shape="rectangle"> <solid android:color="#666666" /> <stroke android:color="#aaaaaa" android:width="1dp"/> </shape> </rotate> </item> <item android:width="30dp" android:height="10dp" android:bottom="21dp" android:gravity="center"> <shape android:shape="rectangle"> <solid android:color="#fff"/> </shape> </item> </layer-list> </item> </layer-list> 

1 answer 1

You must specify the shape and property of this figure <solid> , not <color>

 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <solid android:color="#ddd"/> <corners android:radius="4dp" /> </shape> </item> <item android:gravity="center_vertical|right" android:right="8dp"> <layer-list> <item android:width="12dp" android:height="12dp" android:gravity="center" android:bottom="10dp"> <rotate android:fromDegrees="45" android:toDegrees="45"> <shape android:shape="rectangle"> <solid android:color="#666666" /> <stroke android:color="#aaaaaa" android:width="1dp"/> </shape> </rotate> </item> <item android:width="30dp" android:height="10dp" android:bottom="21dp" android:gravity="center"> <shape android:shape="rectangle"> <solid android:color="#ddd"/> </shape> </item> </layer-list> </item> </layer-list> 

This is what happens:

screen

  • How to make a white background? I need a white background - Victoria
  • Replace for <solid> instead of #ddd -> #fff (in two places, at the beginning and at the end of the file) - pavlofff
  • Damn stepped .. turned out, thanks - Victoria