Field[] fi = R.drawable.class.getDeclaredFields();// 获取文件里的全部对象 for (int i = 0; i < fi.length; i++) { Map<String, Integer> map = new HashMap<String, Integer>(); try { if(fi[i].getName().startsWith("s"))//判断名称是不是以‘s’开头 map.put("img", fi[i].getInt(R.drawable.class)); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } list.add(map);