Search code examples
javaandroidandroid-studioseekbar

How to rotate TextView on SeekBar?


I want to rotate text view on seek bar. I set thumb in center when activity is open.

If thumb is center text view show flat but if thumb slide to left then text view rotate left and if thumb slide right then text view rotate right.


Solution

  • You can use the following code in OnSeekChangeListener

    if(progress<=50){
      textView.setRotation((-90*(50-progress))/50);
    }else{
     textView.setRotation((90*(progress-50))/50);
    }