//动态获取资源ID,第一个参数是资源名,第二个参数是资源类型例如drawable,string等,第三个参数包名 int imageId = getResources().getIdentifier("icon_" + i, "mipmap", getPackageName());