Android学习 | 控件 —— ProgressBar进度条
主要属性
1、android:max:进度条的最大值
2、android:progress:进度条已完成进度值
3、android:indeterminate:如果设置成true,则进度条不精确显示进度
4、style="?android:attr/progressBarstyleHorizontal":水平进度条
非水平进度条实现隐藏与显示
通过getVisibility()获取是否隐藏,View.GONE为已经异常、View.VISIBLE。再根据set方法进行修改。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
android:id="@+id/pb1"
android:layout_width="200dp"
android:layout_height="200dp">
</ProgressBar>
<Button
android:text="按钮"
android:layout_width="200dp"
android:layout_height="80dp"
android:onClick="onclick1">
</Button>