안드로이드 개발 질문/답변
(글 수 45,052)
TableLayout 을 다이얼로그에 썼을때 fill_parent 가 잘안먹는데요.
아래 레이아웃으로 다이얼로그를 만들었습니다.
view들이 100%로 채워지지 않아서 질문드립니다.
EditText를 fill_parent를 하면 다이얼로그에 맞게 나옵니다.
tablelayout에 넣은 아이템들이 fill_parent에 다 채워지지 않고 키보드 한개만큼 뒤에 공백이 생깁니다.
tablelayout에 배경색을 노랑으로 해봤거등요 근데 fill_parent 다 먹히더군요
즉 tablelayout는 다이얼로그 가득차게 넓이가 나옵니다.
근데 아이템들이 뭔하 한칸 뒤에 못채운듯하게 나오는데 왜 그런건가요?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFFFF"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_span="4"
android:layout_column="0"
/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF00"
>
<TableRow
android:stretchColumns="1"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="기 간:"
android:layout_gravity="right|center_vertical"
android:layout_column="0"
/>
<Spinner android:id="@+id/spin_search_gscit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_span="3"
android:layout_column="1"
/>
</TableRow>
<TableRow
android:stretchColumns="1,3"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="생년월일:"
android:layout_gravity="right|center_vertical"
android:layout_column="0"
/>
<Spinner android:id="@+id/spin_search_high"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="~"
/>
<Spinner android:id="@+id/spin_search_low"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:stretchColumns="1"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="검 색 어:"
android:layout_gravity="right|center_vertical"
android:layout_column="0"
/>
<EditText
android:id="@+id/spin_search_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_span="3"
android:layout_column="1"
/>
</TableRow>
</TableLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFBDBDBD"
android:padding="2pt"
>
<Button
android:id="@+id/btn_spin_search_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="조회"
android:layout_weight="1"
/>
<Button
android:id="@+id/btn_spin_search_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="취소"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
아래 레이아웃으로 다이얼로그를 만들었습니다.
view들이 100%로 채워지지 않아서 질문드립니다.
EditText를 fill_parent를 하면 다이얼로그에 맞게 나옵니다.
tablelayout에 넣은 아이템들이 fill_parent에 다 채워지지 않고 키보드 한개만큼 뒤에 공백이 생깁니다.
tablelayout에 배경색을 노랑으로 해봤거등요 근데 fill_parent 다 먹히더군요
즉 tablelayout는 다이얼로그 가득차게 넓이가 나옵니다.
근데 아이템들이 뭔하 한칸 뒤에 못채운듯하게 나오는데 왜 그런건가요?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFFFF"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_span="4"
android:layout_column="0"
/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF00"
>
<TableRow
android:stretchColumns="1"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="기 간:"
android:layout_gravity="right|center_vertical"
android:layout_column="0"
/>
<Spinner android:id="@+id/spin_search_gscit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_span="3"
android:layout_column="1"
/>
</TableRow>
<TableRow
android:stretchColumns="1,3"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="생년월일:"
android:layout_gravity="right|center_vertical"
android:layout_column="0"
/>
<Spinner android:id="@+id/spin_search_high"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="~"
/>
<Spinner android:id="@+id/spin_search_low"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
<TableRow
android:stretchColumns="1"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="검 색 어:"
android:layout_gravity="right|center_vertical"
android:layout_column="0"
/>
<EditText
android:id="@+id/spin_search_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_span="3"
android:layout_column="1"
/>
</TableRow>
</TableLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFBDBDBD"
android:padding="2pt"
>
<Button
android:id="@+id/btn_spin_search_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="조회"
android:layout_weight="1"
/>
<Button
android:id="@+id/btn_spin_search_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="취소"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>