我想使用访问图片
image.setImageResource(R.drawable.photo1);
如何将“photo1”更改为“photo”+#(递增数字),以便我可以在迭代中使用它?
最佳答案
int resID = getResources().getIdentifier("photo"+1,"drawable", getPackageName());
image.setImageResource(resID);
关于android - 在android中使用变量访问XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7760661/