android 自定义progressBar

 
//【使用progressBar】



<ProgressBar

                    android:id="@+id/level_progressBar1"

                    style="@style/Widget.Holo.Light.orange_ProgressBar.Horizontal"

                    android:layout_width="120dp"

                    android:layout_height="wrap_content"

                    android:layout_below="@+id/exp_tv"

                    android:layout_centerHorizontal="true" />







//【res/values/styles.xml】



<style name="Widget.Holo.Light.orange_ProgressBar.Horizontal" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">

        <item name="android:progressDrawable">@drawable/progress_horizontal_orange_holo_light</item>

    </style>







//【res/drawable/progress_horiaontal_orange_holo_light.xml】



    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">



    <item android:id="@android:id/background"

          android:drawable="@drawable/orange_progress_bk" />



    <item android:id="@android:id/secondaryProgress">

        <scale android:scaleWidth="100%"

               android:drawable="@drawable/orange_progress_light_bk" />

    </item>



    <item android:id="@android:id/progress">

        <scale android:scaleWidth="100%"

               android:drawable="@drawable/orange_progress_light_bk" />

    </item>



</layer-list>

  

 //补充:orange_progress_bk、orange_progress_light_bk、orange_progress_light_bk是三张9.patch图片

  

你可能感兴趣的:(ProgressBar)