在布局中,当我单击其中一个时,我单击一个按钮以显示 res /drawable 中所有可绘制对象的列表 我必须显示相同的布局 我的问题是如何访问用户之前单击的按钮
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
setContentView(layoutIds[position]);
Button button=allButtonsInLayout.get(arg2);
button.setBackgroundResource(R.drawable.images_sos);
}
如果我这样做,我可以改变背景:
Button button=(Button)findViewById(R.id.button);
但是如果我将该行更改为
Button button=allButtonsInLayout.get(arg2);