SeekBar not setting actual progress. SetProgress() not working on early Android Versions [duplicate]

半腔热情 提交于 2019-12-21 17:39:29

问题


I have an app where I want to set the progress of a specific SeekBar based upon a value retrieved from a web service. However when I use SetProgress(int) only the "seeker" of the SeekBar gets set. The bar does not get "filled" out as expected.

This is what it looks like :

Any ideas on how to fix this issue ?


回答1:


Try to set max value first and then set the progress.




回答2:


Turns out this is a bug in Android. See also:

http://code.google.com/p/android/issues/detail?id=12945

Android SeekBar doesn't refresh after dynamically setting max value with setMax

android progressBar does not update progress view/drawable

A workaround is to do something like setMax(0) followed by setMax(max) and then setProgress().



来源:https://stackoverflow.com/questions/10278467/seekbar-not-setting-actual-progress-setprogress-not-working-on-early-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!