如何为API级别<23的item
内的layer-list
设置重力?
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:startColor="#A7A7A7"
android:endColor="#C2C2C2"
android:angle="315" />
<corners
android:topLeftRadius="14dp"
android:topRightRadius="14dp" />
</shape>
</item>
<item android:gravity="bottom"><!--This is not working-->
<shape android:shape="rectangle">
<solid android:color="#FF5F5D" />
<size android:height="16dp" />
</shape>
</item>
</layer-list>
答案 0 :(得分:1)
尝试这样
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FF5F5D" />
<corners android:topLeftRadius="14dp"
android:topRightRadius="14dp" />
</shape>
</item>
<item
android:bottom="16dp">
<shape android:shape="rectangle"
android:visible="true"
android:dither="true"
android:useLevel="false">
<gradient
android:startColor="#A7A7A7"
android:endColor="#C2C2C2"
android:angle="315" />
<corners android:topLeftRadius="14dp"
android:topRightRadius="14dp" />
</shape>
</item>
</layer-list>