ProgressBar可以设置样式常见的有大圆圈小圆圈,还有就是横这的进度条这里要通过style来设置
android:id="@+id/pb_one"
style="?android:attr/progressBarStyleLarge"//这里是设置样式的用?
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:id="@+id/pb_two"
style="?android:attr/progressBarStyleHorizontal" //水平进度条
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progress="30" //设置第一进度条的当前进度为30,默认为100
android:secondaryProgress="50" /> //设置第二进度条的当前进度为50,默认为100
通过点击来让进度条增加和减少就比较简单了
思路就是获得当前进度值,然后加上进度,在设置当前进度就可以了。
int pro = pb_two.getProgress();
int cf = pro+10;
pb_two.setProgress(cf);
减少同理