/** * 根据图片名字反射出图片ID * @return */ public static int getImageID(String name){ int id = -1; try { Field field=R.mipmap.class.getDeclaredField(name); String str=field.get(null).toString(); id=Integer.parseInt(str); } catch (Exception e) { e.printStackTrace(); } return id; }
Android根据图片名字获取图片ID
猜你喜欢
转载自blog.csdn.net/qq_27400335/article/details/79899247
今日推荐
周排行