简体   繁体   中英

Sliding 1 seekbar is causing Both Seekbars to change thumbs

This is a strange one. I have 2 seek bars and I have established a listener for both. However when I slide the thumbbar for one seekbar - it updates that seekbar AND it also moves the thumb of the second seekbar.

If I move the thumb on the second seekbar - it only changes the second sekbar NOT the first.

If I remove the listener for the first seekbar - I get the same problem.

I have attached code pertiaing to the seekbar listeners. mSeekBarA is the first one. mSeekBarB is the second.

      mSeekBarA.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
      { 

           @Override 
           public void onStopTrackingTouch(SeekBar seekBar)
           { 

           } 

           @Override 
           public void onStartTrackingTouch(SeekBar seekBar)
           { 
            // TODO Auto-generated method stub 

           } 

           @Override 
           public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
           { 
           On_SFX_Volume_Change(progress);

           } 
      }); 


      mSeekBarB.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
      { 

           @Override 
           public void onStopTrackingTouch(SeekBar seekBar)
           { 

           } 

           @Override 
           public void onStartTrackingTouch(SeekBar seekBar)
           { 
            // TODO Auto-generated method stub 

           } 

           @Override 
           public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
           { 
               On_MUS_Volume_Change(progress);

           } 
      }); 

Thank you !

How did you instantiate these sliders? I bet that they are actually referring to the same instance. Possibly you added the same slider to the layout instead of adding the each one individually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM