본문 바로가기

ANDROID/되새김질

안드로이드 복습 - 4 TableLayout

#table layout
       1. table 형태의 layout을 말한다.
       2. tablerow : 행을 의미하며 tablelayout의 하위구성요소이다.
       3. stretchColums : tablerow에 포함되어 있는 view의 폭에 맞추어 열을 자동확장 하는 것을 말한다.

 

1
2
3
4
5
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1,2">
 
cs

 

Line5 stretchColumns의 value가 1,2여서 index[1]번째와 index[2]번째의 비율이 같아짐.

0,1,2였으면 셋이 같은비율

아무것도 없으면 걍 구석에 짜져있음

 

 

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
 <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
 
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onButton1Ball"
            android:text="Button" />
 
        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onButton1Ball"
            android:text="Button" />
 
    </TableRow>
 
    <TableRow
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
 
        <Button
            android:id="@+id/button4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onButton1Ball"
            android:text="Button" />
 
        <Button
            android:id="@+id/button5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="onButton1Strike"
            android:text="Button" />
 
    </TableRow>
 
cs