开发者

Android - change value of SeekBar within a row (created using ListAdapter)

开发者 https://www.devze.com 2023-02-28 02:46 出处:网络
I\'ve got a ListView which is \"created\" using a custom class that extends ListAdapter. I do this by calling

I've got a ListView which is "created" using a custom class that extends ListAdapter. I do this by calling

listView.setAdapter(new DeviceAdapter...);

The DeviceAdapter开发者_Go百科 class creates a ListView row with a SeekBar in it. At runtime I'd to be able to change the value of the SeekBar. How can I accomplish this?


Step #1: Ensure that your data model -- whatever it is that you are using to populate your rows in your adapter's getView() or bindView() -- has the updated data for your SeekBar.

Step #2: Iterate over the children of the ListView (see methods on ViewGroup for this), and if one of them is the row that you want to update, update the SeekBar.

Step #3: Ensure that you apply the revised data if the user scrolls and you are now binding data to the row that contains the SeekBar you wanted to modify.

0

精彩评论

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