1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="0,1,2">
 
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
 
        <TextView
            android:layout_height="wrap_content"
            android:layout_weight="wrap_content"
            android:text="이름 : " />
 
        <EditText
            android:layout_height="wrap_content"
            android:layout_span="2"
            android:layout_weight="wrap_content" />
 
    </TableRow>
 
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
 
        <Button
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_weight="wrap_content"
            android:text="예" />
 
        <Button
            android:layout_height="wrap_content"
            android:layout_column="2"
            android:layout_weight="wrap_content"
            android:text="아니오" />
 
    </TableRow>
 
</TableLayout>
cs

 

기본적으로 TableLayout안에 TableRow로 구성됨

 

android:stretchColumns="0,1,2" : 0,1,2번 컬럼(뷰)을 나머지 공간에 대하여 늘린다(가로) - 3등분 한다

android:layout_span="2" : 뷰가 2칸 크기만큼을 차지한다.

android:layout_column="1" : 뷰가 1번 칸에 들어간다.

 

결과 화면

+ Recent posts