Android/기본
Linear Layout orientation
Bohemian life
2012. 4. 28. 19:34
뷰배치시 안정적으로 배치하기위해서 절대좌표 사용하지말고 상대좌표을 사용하도록하자.
LinearLayout
LinearLayout를 사용할때 android:orientation : vertical => 세로배치
horizontal => 가로배치
<?xml version="1.0" encoding="utf-8"?> <!-- LinearLayout를 사용할때 android:orientation : vertical -> 세로배치 horizontal -> 가로배치 --> <!-- 세로 배치 --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="첫번째" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="두번째" /> <!-- 가로 배치 --> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="세번째" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="네번째" /> </LinearLayout> </LinearLayout>