View ID

http://developer.android.com/guide/topics/ui/declaring-layout.html#id

id는 xml 에 'id' attribute로 정의되어 컴파일 후에 정수로서 R.java 에서 참조된다.

 

id 선언

android:id="@+id/my_button"

  •  @ : 파서는 이곳이 리소스 id를 선언하는 곳임을 알게 된다.
  •  + : 이 id는 새로 작성되어 추가되는 리소스 이름임을 의미한다.(R.java)
  • android framework 에 정의된 많은 리소스 id도 있다. 

id 참조

android:id="@android:id/empty"

  • 참조시에는 + 기호는 필요없지만 android package namespace ("@android:")로 구성해야 한다.

  • @android 로 지정한 namespace는 android.R class 에서 id 정보를 획득하게 된다. 즉, {local package}.R 클래스가 아니다.

--

android.R class , {local package}.R 에 대해 좀 더 ...
profile
Go for it. Go for 10-thousand.