更新的EditText在列表视图从一个搜索栏值视图、列表、EditText

由网友(︶ㄣ素衣白裳ら)分享简介:我有一个ListView和每一行项目包括搜索栏和一个EditText的(如下图)。我需要根据搜索栏的值,我能够做的,如果我有两个小部件引用没有问题,以更新的EditText。I have a ListView and each row item comprises of a SeekBar and an EditTe...

我有一个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(...);
阅读全文

相关推荐

最新文章