开发者

how to maintain progress bar in android?

want to create listview with 2 component in every row 1st progressbar and 2nd Button that display a current value开发者_如何学运维 of progressbar.

for that i m using custom list view the problem is that when i scroll the listview the progressbar cant maintain it's previous state.

Please help me out to solve this problem.

Thanks In Advance.


you can do that by using following logic.

1 create one arraylist for example.

`public ArrayList<integer> progValue = new ArrayList<integer>();`

2 now in custom list adapter class constructor initialize progvalue with value "0" as following

for(int i = 0; i < yourLIst.size(); i++) { progValue.add(i,0); }

3 now in the progress bar change listener change the value of progValue object as per your progress bar value like

progValue.add(i,p_value)

4 finally set that value in your in getView method. like

progObject.setProgress(progValue.get(pos));

That's all.

change the code as per your requirement i have put just for example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜