안드로이드 개발 질문/답변
(글 수 45,052)
fill parent 로 전체를 채울순있지만
ㅁㅁ
ㅁㅁ
ㅁㅁ
ㅁㅁ
저렇게 크기가 같은 8개의버튼을 안드로이드 화면에
모든 해상도에서 호환되도록 꽉채워서 어떻게 이어 붙여야할까요..?
하려고 하면 할수록 자꾸 한쪽으로 줄줄이 내려가네요..
ex
ㅁ
ㅁ
ㅁ
ㅁ
ㅁ
.
.
.
2012.01.05 16:23:39
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="1"
android:layout_weight="1"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="2"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="3"
android:layout_weight="1"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="4"
android:layout_weight="1"/>
</LinearLayout>
리니어레이아웃일때 orientation=vertical로 처음 주시고
안의 리니어 레이아웃을 horizontal로 주시고 버튼을 넣으신다음 각 버튼에 layout_weight를 1로 주시면 됩니다. ㅎ



