嘿我想在ListView中进行更改,就像listview中TextView上的textchange一样。但这应该不会发生在ItemClick它应该发生在restoreInstance状态任何帮助将在这里是赞赏我的代码
@Override
public void onRestoreInstanceState(Bundle savedInstanceState){
super.onRestoreInstanceState(savedInstanceState);
View v1 = inventoryList.getChildAt(2);
if(v1 != null){
TextView tx = (TextView) v1.findViewById(R.id.txt_location);
tx.setText("why does this not work");
}
}
答案 0 :(得分:0)
在对notifyDataSetChanged()
ListView
方法
@Override
public void onRestoreInstanceState(Bundle savedInstanceState){
super.onRestoreInstanceState(savedInstanceState);
View v1 = inventoryList.getChildAt(2);
if(v1 != null){
TextView tx = (TextView) v1.findViewById(R.id.txt_location);
tx.setText("why does this not work");
// You're missing this
inventoryList.getAdapter().notifyDataSetChanged();
// Or simply call
// adapter.notifyDataSetChanged(); // if you maintain a reference to the adapter
}
}