String imageName = "index_fragmen"+getColor();
final int resId = context.getResources().getIdentifier(imageName, "drawable", context.getPackageName());
if (resId != 0) {
Log.e("mytest", "可以获取到");
holder.btnCoupon.setBackgroundResource(resId);
}

 

 程序猿必读

相关文章:

  • 2022-01-07
  • 2022-01-07
  • 2021-05-16
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
相关资源
相似解决方案