안드로이드 레이아웃도 HTML의 TABLE, TR과 비슷한 태그가 있다.


TableLayout: 테이블 형태의 layout 설정

android:stretchColumns="컬럼 수 0, 1, 2, 3"

TableRow: 테이블 행 (TR) 설정

android:layout_span="몇 개의 columns를 먹을지"

android:layout_column="몇 번째 컬럼에 들어갈지"





<?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,3"
>

<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
>

<TextView
android:layout_width="1dp"
android:layout_height="wrap_content"
android:text="testText"

/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_span="2"

/>

</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="b"
android:layout_span="2"

/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="b1"

/>



</TableRow>

</TableLayout>


+ Recent posts