two Bars which shows the progress of a game. If the user get points or time is up etc the progressBars should be updated:
private TextView tv;
private Progre
Create updateThumb(); method in VerticalSeekbar
public void updateThumb(){
onSizeChanged(getWidth(), getHeight(), 0, 0);
}
And then call update thumb method after setting progress.
seekBar.setProgress((int) progress);
seekBar.updateThumb();
its work for me in verticalseekbar calss
everyone. in case of the exist progress and the new progress value is same, the progressbar is not update. so you set the new value as the near value, that is easy way.
@Override
public synchronized void setProgress(int progress)
{
if (getProgress() == progress)
{
if (progress > 0) progress -= 1;
else progress += 1;
}
super.setProgress(progress);
}
Thanks Stuck for the post stating that there is an Android bug. I also have a vertical seek bar.
The issue was when I was changing the progress drawable. The drawable would be updated but the bar would be set to 0 and be a very small size. I was able to get it to resize with updateThumb(), but the progress was still at 0.
To set the progress back at the original value I added a mylayer.setLevel(...);. I found this by reading the source code of ProgressBar.doRefreshProgress(...). You might be able to do seekBar.getProgressDrawable.setLevel(...)
.
LayerDrawable mylayer = //new LayerDrawable()
seekBar.setProgressDrawable(mylayer);
seekBar.updateThumb();
seekBar.setProgress((int) chLevel);
mylayer.setLevel((int) (chLevel / MAX_LEVEL * 10000));