资源文件
<string-array name="location_text">
<item>横向</item>
<item>纵向</item>
</string-array>
<string-array name="location_grey_icons">
<item>@drawable/landscape_orientation_grey</item>
<item>@drawable/portrait_grey</item>
</string-array>
<string-array name="location_select_icons">
<item>@drawable/landscape_orientation_select</item>
<item>@drawable/portrait_select</item>
</string-array>
获取资源
Map<String, Object> map;
TypedArray grey = getResources().obtainTypedArray(R.array.location_grey_icons);
TypedArray select = getResources().obtainTypedArray(R.array.location_select_icons);
String[] titleArr = getResources().getStringArray(R.array.location_text);
for(int i=0; i<titleArr.length; i++) {
map = new LinkedHashMap<>();
map.put("icon_grey", grey.getResourceId(i, 0));
map.put("icon_select", select.getResourceId(i, 0));
map.put("title", titleArr[i]);
List<Map<String, Object>> list =new ArrayList<>();
list.add(map);
}