본문 바로가기
안드로이드/View

[inflate]

by 파워킴 2013. 8. 21.
반응형

# inflate 사용.

- 참고 : http://aroundck.tistory.com/39


> Inflate 사용 1 :

LayoutInflater inflater = (LayoutInflater) getSystemService( Context.LAYOUT_INFLATER_SERVICE ); 
LinearLayout linearLayout = (LinearLayout) inflater.inflate( R.layout.inflate_example, null ); 
setContentView( linearLayout ); 


> Inflate 사용 2:

LayoutInflater inflater = LayoutInflater.from( this );
LayoutInflater inflater = getLayoutInflater(); ( @activity )


인플레이터를 얻어오는 것과 inflate 를 하는 것을 한줄로 하려면..
LinearLayout linearLAyout = (LinearLayout) VIew.inflate( this, R.layout.inflate_example, null );


반응형

'안드로이드 > View' 카테고리의 다른 글

[ListView] 중복 리스트뷰  (0) 2013.08.21

댓글