[Android] 用字串找R檔



Context context = imageView.getContext();
int id = context.getResources().getIdentifier("picture0001", "drawable", context.getPackageName());
imageView.setImageResource(id);

提醒

本站內容即日起將轉到另一站上轉跳~