我试图做这样的事情:背景样式不上的进度条显示
这是我的代码做什么:
我将此代码存入我的可绘制文件中:
progress_bar_layout.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:innerRadius="70dp"
android:shape="ring"
android:thickness="18dp">
</shape>
</item>
<item android:id="@android:id/progress">
<shape
android:innerRadius="70dp"
android:shape="ring"
android:thickness="18dp">
<gradient
android:endColor="#ff0f315f"
android:startColor="#ff005563"
android:type="sweep" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<shape
android:innerRadius="70dp"
android:shape="ring"
android:thickness="18dp">
<gradient
android:endColor="#ff1490e4"
android:startColor="#ff00c0dd"
android:type="sweep" />
</shape>
</item>
</layer-list>
布局:
<ProgressBar
android:id="@+id/bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="180dp"
android:layout_height="180dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:max="100"
android:progress="99"
android:progressDrawable="@drawable/progress_bar_layout"
android:secondaryProgress="30" />
的问题是,我的背景风格不显示出来。这就是为什么我使用进度来完成背景的工作,但正如你所看到的,它不能很好地工作,最大尺寸是99,最后还有一个空间。我错过了一些代码?
你可以上传你正在努力实现的,它可以很容易地在女士造漆或Photoshop –
图像@LX已经可用。 –
如果你只是想在黑色背景后面progressBar只需在你的标签中设置这个android:background =“#222222”,它将会诀窍 –