似乎形状填充不适用于pre 6 Android。我正在尝试将填充添加到自定义ProgressBar
背景渐变以及我拥有的内容:
Android 6.0:
Android 5.0及以下版本:
pb_shape.xml
:
<?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 android:shape="rectangle">
<corners android:radius="12dip" />
<stroke
android:width="1dip"
android:color="@color/primary_white" />
<gradient
android:angle="270"
android:centerColor="@color/primary_black"
android:centerY="0.5"
android:endColor="@color/primary_black"
android:gradientRadius="12dip"
android:startColor="@color/primary_black" />
<!--This not working pre 6 android-->
<padding
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="12dip" />
<gradient
android:angle="0"
android:endColor="@color/primary_teal"
android:startColor="@color/primary_blue_dark" />
</shape>
</clip>
</item>
我已经尝试将这两个项目包装在不同的xml文件中并在那里设置padding,但它不起作用:
<item
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp"
android:drawable="@drawable/pb_gradient_bg"
/>
任何想法导致此行为的原因以及可能的解决方案是什么?
答案 0 :(得分:0)