andriod中drawable文件名获取id

字符串文件名获取id整型值

Class<drawable> cls = R.drawable.class;
  try {
       Integer value = cls.getDeclaredField("aa").getInt(null);
        Log.v("value",value.toString());
      } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
     }

猜你喜欢

转载自skytiger0419.iteye.com/blog/2102007
今日推荐