ProgressBar分为水平和垂直的
public class ProgressActivity extends AppCompatActivity { private LinearLayout ll_progress_loading; private ProgressBar pb_progress_loading; private SeekBar sb_progress_loading; private SeekBar.OnSeekBarChangeListener onSeekBarChangeListener = new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { //滑杆移动 Log.e("TAG","滑杆移动"); // pb_progress_loading.setProgress(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { //按下滑杆 Log.e("TAG","按下滑杆"); } @Override public void onStopTrackingTouch(SeekBar seekBar) { //离开滑杆 Log.e("TAG","离开滑杆"); int progress = seekBar.getProgress(); //获得到滑动按钮的进度 pb_progress_loading.setProgress(progress); //设置给横向进度条 if(progress == pb_progress_loading.getMax()) { ll_progress_loading.setVisibility(View.INVISIBLE);//设置控件为不可见 }else { ll_progress_loading.setVisibility(View.VISIBLE); } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_progress); ll_progress_loading = findViewById(R.id.ll_progress_loading); pb_progress_loading = findViewById(R.id.pb_progress_loading); sb_progress_loading = findViewById(R.id.sb_progress_loading); sb_progress_loading.setOnSeekBarChangeListener(onSeekBarChangeListener); }