Android, SeekBar in dialog

后端 未结 4 1902
自闭症患者
自闭症患者 2020-12-30 11:28

I would like to use a dialog with a seekbar in my application. But I don\'t really know how to do it because I lack experience with android.

So, when you press a but

4条回答
  •  遥遥无期
    2020-12-30 11:40

    This is the code on how to put seekbar in alertdialog: check this link.

    public void ShowDialog(){
     final AlertDialog.Builder popDialog = new AlertDialog.Builder(this);
     final SeekBar seek = new SeekBar(this);
     seek.setMax(255);
     seek.setKeyProgressIncrement(1);
    
     popDialog.setIcon(android.R.drawable.btn_star_big_on);
    popDialog.setTitle("Please Select Into Your Desired Brightness ");
     popDialog.setView(seek);
    
    
       seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
    
    
    
     public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser){
    
    
     txtView.setText("Value of : " + progress);
     }
    

    HAPPY CODING!

提交回复
热议问题