更新的EditText在列表视图从一个搜索栏值 [英] Update EditText in a list view with value from a SeekBar

查看:111
本文介绍了更新的EditText在列表视图从一个搜索栏值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ListView和每一行项目包括搜索栏和一个EditText的(如下图)。我需要根据搜索栏的值,我能够做的,如果我有两个小部件引用没有问题,以更新的EditText。

I have a ListView and each row item comprises of a SeekBar and an EditText (as in figure below). I need to update the EditText based on the seekbar's value, which I'm able to do if I have both the widget references without a problem.

我的问题是我怎么每一个搜索栏,以它的正确的EditText框相关联?这两个部件是,我在我的适配器膨胀视图的一部分。引用一个EditText直接似乎并没有因为在ListView Android的看法再造一个好主意。

My issue is how do I associate each seekbar to its correct EditText box? Both these widgets are part of a view that I inflate in my adapter. Referencing an EditText directly doesn't seem to be a good idea because of Android's view recycling in the ListView.

什么是最好的方式前进?

What is the best way forward?

推荐答案

在显示每对搜索栏和EDITTEXT的只是使用

When you show each pair of SeekBar and editText just use

seekBar.setTag(editText);
editText.setTag(seekBar);

和更新时使用的东西。

seekBar = (SeekBar)editText.getTag();
seekBar.setProgress(...);

这篇关于更新的EditText在列表视图从一个搜索栏值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆