最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android自定義view實(shí)現(xiàn)進(jìn)度條指示效果

 更新時間:2017年01月22日 15:11:50   作者:牛仔面包  
這篇文章主要為大家詳細(xì)介紹了Android自定義view實(shí)現(xiàn)進(jìn)度條指示效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下

先看看效果圖:

首先是布局文件

<FrameLayout
 android:layout_width="match_parent"
 android:layout_marginLeft="10dp"
 android:layout_marginRight="10dp"
 android:layout_height="wrap_content">

 <ProgressBar
  android:id="@+id/pb_process"
  style="@style/ProgressStyle"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:indeterminate="false" />

 <TextView
  android:id="@+id/tv_progress"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center"
  android:textColor="@color/white"/>

</FrameLayout>

添加style-ProgressStyle

<style name="TrainProgressStyle" parent="@android:style/Widget.ProgressBar.Horizontal">
 <item name="android:progressDrawable">@drawable/my_progress</item>
</style>

添加drawable-my_progress

<?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>
   <corners android:radius="5dip" />
   <gradient
    android:angle="270"

    android:centerY="0.75"
    android:endColor="@color/gray_BB"
    android:startColor="@color/gray_BB" />
  </shape>
 </item>

 <item android:id="@android:id/secondaryProgress">
  <clip>
   <shape>
    <corners android:radius="5dip" />
    <gradient
     android:angle="270"
     android:centerColor="#f69200"
     android:centerY="0.75"
     android:endColor="#ff9800"
     android:startColor="#ff9800" />
   </shape>
  </clip>
 </item>

 <item android:id="@android:id/progress">
  <level-list>
   <!-- 進(jìn)度滿時 level = 10000-->
   <item
    android:maxLevel="10000"
    android:minLevel="10000">
    <clip>
     <shape>
      <corners android:radius="5dip" />
      <gradient
       android:angle="270"
       android:centerColor="#21a837"
       android:centerY="0.75"
       android:endColor="#22ac38"
       android:startColor="#22ac38" />
     </shape>
    </clip>
   </item>
   <!-- 進(jìn)度未滿時 level < 10000-->
   <item
    android:minLevel="0"
    android:maxLevel="9999"
    >
    <clip>
     <shape>
      <corners android:radius="5dip" />
      <gradient
       android:angle="270"
       android:centerColor="#f69200"
       android:centerY="0.75"
       android:endColor="#ff9800"
       android:startColor="#ff9800" />
     </shape>
    </clip>
   </item>
  </level-list>
 </item>

</layer-list>

activity里的使用和安卓默認(rèn)的一樣

pb_progress.setMax();
pb_progress.setProgress();

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

云阳县| 汝南县| 尚义县| 双柏县| 那坡县| 南川市| 冀州市| 芦溪县| 宁明县| 武安市| 金溪县| 沁水县| 鄂托克前旗| 玛曲县| 井研县| 万州区| 张掖市| 华宁县| 柯坪县| 太原市| 南和县| 丹寨县| 乌兰察布市| 商都县| 岳普湖县| 赣州市| 五常市| 佛学| 伊宁市| 松江区| 合水县| 安达市| 永宁县| 景洪市| 葫芦岛市| 马关县| 泰来县| 麻城市| 永吉县| 宜章县| 麟游县|