LayoutInflater로 레이아웃 교체하기
레이아웃 전체를 교체하거나 부분을 교체할때 LayoutInflater로 교체를 할 수 있다.
사용 방법은 주석으로 잘달아 놨으니... 걍 저렇게 쓰면 된다.
1 2 3 4 5 6 7 | // activity_main.xml에서 정의한 LinearLayout 할당 LinearLayout inflated = (LinearLayout)findViewById(R.id.changed_layout); // LayoutInflater 객체 생성 LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); // Inflated_Layout.xml로 구성한 레이아웃을 inflated영역(R.id.changed_layout)으로 교체 inflater.inflate(R.layout.new_layout, inflated); |
'Programing > android' 카테고리의 다른 글
PC로 안드로이드 이용하는 방법(그냥 뭐뭐 있는지 정도?) (0) | 2015.05.09 |
---|---|
알수없는 java.net.ConnectException문제 (0) | 2015.01.26 |
android.os.NetworkOnMainThreadException 문제 (0) | 2015.01.22 |
안드로이드 개발환경구축할때 환경변수 (0) | 2014.10.30 |
안드로이드 이미지 프로세싱 Camera.Parameter setPreviewFormat으로 들어오는 포맷을 바꾸려고 하는데... (0) | 2014.10.27 |