2012-01-29 66 views
1

我有一个按钮和一个TextView的ListView,我想在点击按钮时改变TextView的文本。我处理点击,当我点击按钮android:onClick="myClickHandler"我改变了TextView的文本值,但问题是当我滚动ListView时,我在ListView中的其他单元格中发现了相同的文本。我该如何解决这个问题?
tanx很多。

这是处理方法点击
当我们点击按钮时,如何在ListView中更改TextView的文本?

public void myClickHandler(View v) 
{ 

    //get the row the clicked button is in 
    LinearLayout vwParentRow = (LinearLayout)v.getParent(); 
    TextView child = (TextView)vwParentRow.getChildAt(1); 
    child.setText("bma bla"); 

} 

回答

1

刷新listadapter和ListView适配器在同一时间的每一个变化。我认为它会帮助你。

+0

tanx为答案。我会尝试你的解决方案。 – aminovic09 2012-01-29 16:01:30

相关问题