1.동적으로 추가할 미리생성된 xml의 id로 레이아웃을 읽어온다.
ex)
LinearLayout View = (LinearLayout)findViewById(R.id.mainview);2.생성할 위젯을 생성한뒤 추가 한다.
LinearLayout View = (LinearLayout)findViewById(R.id.mainview); Button button = new Button(this); View.addView(button);
'안드로이드' 카테고리의 다른 글
안드로이드 둥근 테두리 배경 넣기 (0) | 2014.08.27 |
---|---|
안드로이드 EditText 자동 포커스 막는방법 (0) | 2014.08.27 |
android sherlock actionbar logo 사용하는 방법 (0) | 2014.08.04 |
android sherlock actionbar 색상 지정 (0) | 2014.08.04 |
android imagebutton 투명처리시 클릭이벤트효과주기 (0) | 2014.07.24 |