ProgressBar的indeterminateDrawable屬性在安卓6.0上的問題

來源:互聯網
上載者:User

標籤:usr   tco   tar   lin   enter   tag   連續   rip   als   

通過indeterminateDrawable屬性去自己定義ProgressBar方法:

    <ProgressBar        android:id="@+id/pb"        android:layout_width="30dp"        android:layout_height="30dp"        android:layout_centerVertical="true"        android:indeterminateDrawable="@drawable/loading" />

當中的loading.xml又能夠有幾種方式:

1.animation-list,由一堆連續性圖片組成:

<?xml version="1.0" encoding="UTF-8"?>  <animation-list android:oneshot="false"    xmlns:android="http://schemas.android.com/apk/res/android">    <item android:duration="50" android:drawable="@drawable/load_1" />    <item android:duration="50" android:drawable="@drawable/load_2" />    <item android:duration="50" android:drawable="@drawable/load_3" />    <item android:duration="50" android:drawable="@drawable/load_4" />    <item android:duration="50" android:drawable="@drawable/load_5" />    <item android:duration="50" android:drawable="@drawable/load_6" />    <item android:duration="50" android:drawable="@drawable/load_7" />    <item android:duration="50" android:drawable="@drawable/load_8" />  </animation-list> 

2.layer-list/rotate,通過一個圖片進行不斷旋轉實現:

<?xml version="1.0" encoding="utf-8"?

> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <rotate android:drawable="@drawable/loading" android:fromDegrees="0.0" android:pivotX="50.0%" android:pivotY="50.0%" android:toDegrees="1000" /> </item> </layer-list>

3.定義一個圓形shape以及顏色旋轉:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"      android:fromDegrees="0"      android:pivotX="50%"      android:pivotY="50%"      android:toDegrees="360" >      <shape          android:innerRadiusRatio="3"          android:shape="ring"          android:thicknessRatio="10"          android:useLevel="false" >          <gradient              android:centerColor="#FFFFFF"              android:centerY="0.50"              android:endColor="#1E90FF"              android:startColor="#000000"              android:type="sweep"              android:useLevel="false" />      </shape>  </rotate>

在使用過程中發現,第一種形式在6.0下面系統完美執行,但在6.0及以上系統無法顯示,假設有遇到此問題的同學能夠選擇其它方式就可以!不顯示的原因未知。可能是6.0的bug。

。。

ProgressBar的indeterminateDrawable屬性在安卓6.0上的問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.