본문 바로가기

Computer Science/Android

android layout inflater

<Inflation>


* 개념

 - xml 문서에 정의된 레이아웃과 차일드 뷰의 속성을 읽어, 실제 뷰 객체를 생성하는 동작 

 - setcontentiview( layout id) ; 전개 역할을 한다. 엑티비티에 xml문서를 통해 만들어진 객체를 채움.

 - view의 동적생성 및 관리시에 필요.


* LayotutInflater 

 - xml 리소스를 전개하여 뷰 객체를 만드는 역할.


 - Inflater 얻어오기.

 1. LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE)

  inflater.inflate();

 2. LayoutInflater inflater = LayoutInflater.from(this);


3. View.inflate( view 가 들어갈 layout의 context, 전개할 view 의 xml, null);



'Computer Science > Android' 카테고리의 다른 글

안드로이드 프로그래밍 정복 ch7  (0) 2013.10.25
android table layout  (0) 2013.10.22
android relative layout  (0) 2013.10.22
android linear layout  (0) 2013.10.22
http post example  (0) 2013.10.22