我正在使用400 imageView进行布局。问题是如何设置R.id.imageView>> i <<
for(int i = 1; i < 401; i++){
ImageView imageView = (ImageView)findViewById(R.id.imageView-i-);
}
答案 0 :(得分:0)
for (int i = 1; i <= 400; i++) {
String s = "imageview" + i;
int id = getResources.getIdentifier(s, "id", getPackageName ());
ImageView imageview = (ImageView)findViewById (id);
}
这应该有效