如何将针宽(进度剪辑)设置为比垂直进度条的背景形状更窄? 我已添加,但剪辑填满了整个视图。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="180"
/>
</shape>
</item>
<item android:id="@android:id/progress">
<clip
android:clipOrientation="vertical"
android:gravity="bottom">
<shape>
<corners android:radius="50dip"/>
<solid android:color="#FF0000"/>
<size android:width="2dp"/>
<stroke
android:width="1dp"
android:color="#000000" />
</shape>
</clip>
</item>
</layer-list>
答案 0 :(得分:0)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="180" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip
android:clipOrientation="vertical"
android:gravity="bottom">
<layer-list>
<item
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp">
<shape>
<corners android:radius="50dip" />
<solid android:color="#FF0000" />
<size android:width="2dp" />
<stroke
android:width="1dp"
android:color="#000000" />
</shape>
</item>
</layer-list>
</clip>
</item>
</layer-list>