Thumb doesn't match up with progress (seekbar)

2019-07-07 01:00发布

问题:

I have a bug after loading my seek bars. The thumb doesn't match with the progress value. After clicking the first time on the progress bar, the thumb moves correctly. Is there any solution for this problem? Thanks for help!

Screenshot:

回答1:

Check that your thumb offset in not set

android:thumbOffset="-10dp"


回答2:

You haven't provided much in the way of detail.

I've found with Android 2.3 and earlier that if I modify the thumb within my code I then need the following sequence:

int progress = getProgress();
setProgress(0);
setProgress(progress);

Otherwise, the thumb will not be in the correct position. You have to call setProgress(0) first because calling set setProgress() with the current position doesn't execute any useful code.