• ProgressBar和SeekBar


    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);
    
        }
  • 相关阅读:
    17.07.28 SQL 函数
    JavaScript 数组去重
    JavaScript 之 DOM
    JavaScript 之 BOM
    JavaScript之Math
    JavaScript之String
    JavaScript之数组
    JavaScript之作用域
    JavaScript之函数
    JavaScript之循环
  • 原文地址:https://www.cnblogs.com/NuoChong/p/11609703.html
Copyright © 2020-2023  润新知