Android中进度条
<ProgressBar android:id="@+id/progress_bar" android:layout_width="match_parent" android:layout_height="wrap_content" //下面两行是将进度条从默认的圆形变为长条 style="?android:attr/progressBarStyleHorizontal" android:max="100" />
设置点击事件:(点击按钮一次进度条会增加十)
public void onClick(View view) { //加逻辑代码 switch (view.getId()){ case R.id.button: int progress = progressBar.getProgress(); progress = progress+10; progressBar.setProgress(progress); default: break; } }