标签:
先看如下代码
<ProgressBar android:id="@+id/progress_bar" style="@style/Voiceunlock.Theme.ProgressBar.Horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginEnd="30dip" android:layout_marginStart="30dip" android:max="100" />
style的代码如下
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" android:drawable="@drawable/scrubber_bg_funui" /> <item android:id="@android:id/secondaryProgress"> <scale android:scaleWidth="100%" android:drawable="@drawable/scrubber_secondary_funui" /> </item> <item android:id="@android:id/progress"> <scale android:scaleWidth="100%" android:drawable="@drawable/scrubber_primary_funui" /> </item> </layer-list>
里面用到的颜色值如下
<?xml version="1.0" encoding="utf-8"?> <resources> <drawable name="scrubber_bg_funui">#000000</drawable> <drawable name="scrubber_secondary_funui">#ff0000</drawable> <drawable name="scrubber_primary_funui">#00ff00</drawable> </resources>
运行结果如下
标签:
原文地址:http://www.cnblogs.com/zhangshuli-1989/p/4449829.html