字符串变量

时间:2018-08-17 12:10:18

标签: android string variables

美好的一天。

在Android上,我有图片资源

  • 图片_1,
  • 图片_2,
  • picture_3,
  • picture_4,
  • picture_5,
  • picture_6,
  • picture_7,
  • picture_8,
  • picture_9,
  • picture_10

我使用代码进行下载:

imageView_1.setImageDrawable(getResources().getDrawable(R.drawable.picture_1));

它运行完美。

但是我该怎么做呢?在变量中使用字符串。

String numer;
numer = "1";

imageView_1.setImageDrawable(getResources().getDrawable(R.drawable.picture_+numer));

0 个答案:

没有答案