[Android] strings.xml Android 2011. 12. 12. 14:42
이곳에는 문자열을 정의 하는 곳이다.

strings.xml 파일을 열어보면 <string name="idvalue"> 식으로 시작 되는 것이 있다.

idvalue 이것이 바로 id 값이다. 쉽게 생각하면 변수 명이라고 생각을 하면 된다.

안드로이드 어플리케이션 상에서 문자열들은 이곳에 정의하고 이용을 한다.

테스트를 해 보자면 strings.xml 부분에

<string name="first">First</string>
 <string name="second">Second</string>
 <string name="third">Third</string>

추가를 하고

main.xml 부분에
<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/first" />
    
<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/second" />
   
<TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/third" />
추가를 한 뒤 실행을 해 보면 그 결과를 알 수 있을 것이다.