日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

自定義ProgressBar的加載效果

系統(tǒng) 1850 0
三種方式實(shí)現(xiàn)自定義圓形頁面加載中效果的進(jìn)度條

To get a ProgressBar in the default theme that is to be used on white/light back ground, use one of the inverse styles:
<ProgressBar style="@android:style/Widget.ProgressBar.Inverse"/>
<ProgressBar style="@android:style/Widget.ProgressBar.Large.Inverse"/>
<ProgressBar style="@android:style/Widget.ProgressBar.Small.Inverse"/>

進(jìn)度條
    <ProgressBar android:layout_width="fill_parent" android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal"  />
  

一、通過動(dòng)畫實(shí)現(xiàn)
定義res/anim/loading.xml如下:
    <?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
  xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:duration="150" android:drawable="@drawable/loading_01" />
  <item android:duration="150" android:drawable="@drawable/loading_02" />
  <item android:duration="150" android:drawable="@drawable/loading_03" />
  <item android:duration="150" android:drawable="@drawable/loading_04" />
  <item android:duration="150" android:drawable="@drawable/loading_05" />
  <item android:duration="150" android:drawable="@drawable/loading_06" />
  <item android:duration="150" android:drawable="@drawable/loading_07" />
</animation-list> 
  


在layout文件中引用如下:
    
<ProgressBar
  android:layout_width="wrap_content" 
android:layout_height="wrap_content"
  android:indeterminate="false" 
android:indeterminateDrawable="@anim/loading" />

  


二、通過自定義顏色實(shí)現(xiàn)
定義res/drawable/dialog_style_xml_color.xml如下:
    
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0"
android:toDegrees="360">
<shape android:shape="ring" android:innerRadiusRatio="3"
  android:thicknessRatio="8" android:useLevel="false">
  <gradient android:type="sweep" android:useLevel="false"
   android:startColor="#FFFFFF" android:centerColor="#FFDC35"
   android:centerY="0.50" android:endColor="#CE0000" />
</shape>
</rotate>
  


在layout文件中引用如下:
    
<ProgressBar
  android:layout_width="wrap_content" 
android:layout_height="wrap_content"
  android:indeterminate="false" android:indeterminateDrawable="@drawable/dialog_style_xml_color" />

  


三、使用一張圖片進(jìn)行自定義
定義res/drawable/dialog_style_xml_icon.xml如下:
    
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
  <rotate android:drawable="@drawable/dialog_progress_round"
   android:fromDegrees="0.0" 
android:toDegrees="360.0" 
android:pivotX="50.0%"
   android:pivotY="50.0%" />
</item>
</layer-list>
  


在layout文件中引用如下:
    
<ProgressBar
  android:layout_width="wrap_content" 
android:layout_height="wrap_content"
  android:indeterminate="false" android:indeterminateDrawable="@drawable/dialog_style_xml_icon" />

  


或者使用<animated-rotate/>旋轉(zhuǎn)一張圖片:
    
<ProgressBar  
        style="@android:style/Widget.ProgressBar"  
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"  
        android:indeterminateDrawable="@drawable/custom_progress_draw"  
        android:indeterminate="false" />

  

custom_progress_draw.xml:
    
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/circular"
    android:pivotX="50%"
    android:pivotY="50%" />

  

circular就是一張轉(zhuǎn)動(dòng)效果的靜態(tài)圖片。

main.xml如下:
    
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center"
android:background="#FFF">
<Button android:text="@string/anim" android:id="@+id/anim"
  android:layout_width="120dip" android:layout_height="wrap_content" />
<Button android:text="@string/color" android:id="@+id/color"
  android:layout_width="120dip" android:layout_height="wrap_content" />
<Button android:text="@string/icon" android:id="@+id/icon"
  android:layout_width="120dip" android:layout_height="wrap_content" />
</LinearLayout>
  





新浪下載圖片的ProgressBar進(jìn)度樣式源碼
http://www.eoeandroid.com/code/2012/0711/1851.html


一個(gè)絢麗的loading動(dòng)效分析與實(shí)現(xiàn)!
http://blog.csdn.net/tianjian4592/article/details/44538605


很酷的Android下載進(jìn)度條:DownloadProgressBar

自定義ProgressBar的加載效果


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!??!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 体育| 敦化市| 集贤县| 丹凤县| 龙江县| 六安市| 奈曼旗| 涿州市| 库尔勒市| 新邵县| 旅游| 桂平市| 临清市| 阿克苏市| 宁蒗| 鄂托克旗| 泰和县| 崇信县| 唐海县| 青浦区| 宜宾县| 固原市| 本溪市| 虹口区| 九江市| 巩义市| 南平市| 玉山县| 桐庐县| 顺昌县| 开原市| 天柱县| 普宁市| 南康市| 沂南县| 介休市| 扎囊县| 阜宁县| 类乌齐县| 攀枝花市| 临桂县|