Android根据图片名称加载Drawable里面的图片并且显示

来源:互联网 发布:软件开发难吗 编辑:程序博客网 时间:2024/04/27 16:31
public static int getimages(String name){    Class drawable = R.drawable.class;    Field field = null;    try {        field =drawable.getField(name);        int images = field.getInt(field.getName());        return images;    } catch (Exception e) {        e.printStackTrace();    }    return 0;}
阅读全文
0 0
原创粉丝点击