我想做一个进度条,如下所示。我读了一些文档,知道我可以创建自己的自定义可绘制文件,并在进度条组件的样式中提供该文件来实现这一点。但我不能创建自定义的XML文件为下面的设计。任何形式的帮助都将不胜感激。
我的自定义XML文件看起来像下面这样,`
<item android:id="@android:id/background">
<shape android:shape="rectangle" >
<corners android:radius="6dp"/>
<solid android:color="#D9D9D9"/>
</shape>
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%">
<shape android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="#ff5757"/>
</shape>
</scale>
</item>
`
图标XML是,
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M960.1,258.4L245.8,258.4l-36.1,-169L63.9,89.4v44h110.2l26.7,125 100.3,469.9 530,0.4v-44l-494.4,-0.3 -22.6,-105.9L832,578.5l128.1,-320.1zM895.1,302.4L855.6,401L276.3,401l-21.1,-98.6h639.9zM304.8,534.5L279.7,417h569.5l-47,117.5L304.8,534.5z"
android:fillColor="#39393A"/>
<path
android:pathData="M375.6,810.6c28.7,0 52,23.3 52,52s-23.3,52 -52,52 -52,-23.3 -52,-52 23.3,-52 52,-52m0,-20c-39.7,0 -72,32.2 -72,72s32.2,72 72,72 72,-32.2 72,-72 -32.3,-72 -72,-72zM732,810.6c28.7,0 52,23.3 52,52s-23.3,52 -52,52 -52,-23.3 -52,-52 23.3,-52 52,-52m0,-20c-39.7,0 -72,32.2 -72,72s32.2,72 72,72c39.7,0 72,-32.2 72,-72s-32.3,-72 -72,-72zM447.5,302.4h16v232.1h-16zM652,302.4h16v232.1h-16z"
android:fillColor="#E73B37"/>
<path
android:pathData="M276.3,401l3.4,16 -3.4,-16z"
android:fillColor="#343535"/>
</vector>
我无法将图标XML集成到进度条XML中以获得所需的XML。
1条答案
按热度按时间bcs8qyzn1#
请检查它是如何在这个图书馆。这将有助于实现您的目标https://github.com/MackHartley/RoundedProgressBar?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=8327
阿森纳链接:https://android-arsenal.com/details/1/8327