android之組件3

 

 ProgressBar(進度條)

編寫main.xml文件

<ProgressBar水平進度條 
        style="@android:style/Widget.ProgressBar.Horizontal"設置爲水平樣式
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:max="1000"  設置總長度  
        android:progress="100"/>  開始進度爲100    
     <ProgressBar環形進度條 
        android:id="@+id/bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:max="100"
        android:progress="10"
        android:layout_marginTop="20dp"/>


注:代碼中開啓一個新線程,並在新線程中循環10000次,每次循環更新進度條的當前值,並且刷新界面

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章