본문 바로가기

카테고리 없음

TableLayout 만들기

결과



table_layout.xml


<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="#53DAC8"
    android:padding="30dp" >

    <TableRow>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp"
            android:layout_span="4"
            android:text="계산결과 : "
            android:textSize="25dp" />
    </TableRow>

    <TableRow>
        <Button android:text="1" />
        <Button android:text="2" />
        <Button android:text="3" />
        <Button android:text="+" />
    </TableRow>

    <TableRow>
        <Button android:text="4" />
        <Button android:text="5" />
        <Button android:text="6" />
        <Button android:text="-" />
    </TableRow>

    <TableRow>
        <Button android:text="7" />
        <Button android:text="8" />
        <Button android:text="9" />
        <Button android:text="x" />
    </TableRow>

    <TableRow>
        <Button android:text="0" />
        <Button
            android:layout_span="2" android:text="=" />
        <Button android:text="/" />
    </TableRow>

</TableLayout>