1、ProgressBar 进度条

当水平进度条完成后,隐藏该进度条,并显示一张图片

Android ProgressBar SeekBar

常用属性:
  1. android:max 设置进度条的最大值
  2. android:progress 用于指定进度条的已完成的进度值
  3. android:progressDrawable 用于设置进度条的轨道绘制形式
style属性:
  1. ?android:attr/progressBarStyleHorizontal 细水平长条进度条
  2. ?android:attr/progressBarStyleLarge 在圆形进度条
  3. ?android:attr/progressBarStyleSmall 大圆形进度条
  4. @android:style/Widget.ProgressBar.Large 大跳跃,旋转画面的进度条
  5. @android:style/Widget.ProgressBar.Small 小跳跃,旋转画面的进度条
  6. @android:style/Widget.ProgressBar.Horizontal 粗水平长条进度条
ProgressBar的水平样式中自身是不会动的,必须在代码中设置进度才会改变。

  public synchronized void setProgress(int progress)//设置进度

 

 

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     android:layout_width="match_parent"
 3     android:layout_height="match_parent"
 4     android:orientation="vertical" >
 5 
 6     <ProgressBar
 7         android:id="@+id/progressBar3"
 8         style="?android:attr/progressBarStyleHorizontal"
 9         android:layout_width="match_parent"
10         android:layout_height="wrap_content"
11         android:layout_centerInParent="true"
12         android:layout_margin="20dp"
13         android:progress="40" />
14 
15     <TextView
16         android:id="@+id/tv"
17         android:layout_width="wrap_content"
18         android:layout_height="wrap_content"
19         android:layout_alignRight="@id/progressBar3"
20         android:layout_below="@id/progressBar3"
21         android:text="0/100" />
22 
23     <ImageView
24         android:id="@+id/img"
25         android:layout_centerInParent="true"
26         android:layout_width="wrap_content"
27         android:layout_height="wrap_content"
28         android:src="@drawable/ic_launcher"
29         android:visibility="gone" />
30 
31 </RelativeLayout>
activity_main.xml

相关文章: