我需要帮助,我有3x3表。单击后如何在gridView中重新加载图像?我想简单的应用1点击= 1点。
Stack | State | Input | Action
-------------------+-------+------------------+----------
| (1) | abb | Shift, go to (3)
a | (3) | bb | Shift, go to (2)
ab | (2) | b | ???
答案 0 :(得分:1)
您可以像这样添加OnClick:
final ImageView img = (ImageView) findViewById(imgIds[i]);
img.setClickable(true);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
img.setImageDrawable(
getResources().getDrawable(getResourceID(str, "mipmap", getApplicationContext()))
);
}
});