我的列表视图有问题!当我更改行值(在文本视图上)并执行列表的 scoll 时,我丢失了值(并返回我的第一个设置)!例如,如果我创建一个包含 50 个 textview 且 text =“Example no.1”的列表视图,如果我在滚动列表后更改值 (onItemClick),则 textview 值为“Example no.1”。
这是我的示例代码:
.............................................
String sItems = new String[50];
HashMap<String,Object> personMap=new HashMap<String, Object>();
.............................................
sItems[iCnt] = "Example no.1";
personMap.put("title", sItems[iCnt]);
data.add(personMap);
.............................................
String[] from={"title"};
int[] to={R.id.rowTextView};
final SimpleAdapter adapter=new SimpleAdapter(getApplicationContext(),data,R.layout.all_textview,from,to);
final ListView listView = (ListView) findViewById(R.id.cd_sel_title_listview_textview);
listView.setAdapter((adapter));
listView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> arg0, View v, int position, long id)
{
TextView textView = (TextView) v.findViewById(R.id.rowTextView);
textView.setText("Example No.2");
}
});
.............................................
我哪里错了?谢谢