안드로이드 개발 질문/답변
(글 수 45,052)
res/drawable
A_1.png
A_2.png
A_3.png
A_4.png
A_5.png
-----------------------------------
res/values/array.xml
<resources>
<string-array name="test">
<item>A_1</item>
<item>A_2</item>
<item>A_3</item>
<item>A_4</item>
<item>A_5</item>
</string-array>
</resources>
array.xml의 item의 각각의 값과 drawable의 png파일들은 이름이 같습니다.
java 코드상에서 이미지를 불러올때
private Integer[] main_menu_icons = {
R.drawable.A_1, R.drawable.A_2,
R.drawable.A_3, R.drawable.A_4,
R.drawable.A_5,
};
String[] test_list = res.getStringArray(R.array.test); 를 이용해서
for(i=0; test_list.length < i; i++){
R.drawable.test_list[i]
}
와 같은식으로 안되나요? 될거는 같은데 잘 모르겠네요...