본문 바로가기
App/Android Studio

Android Studio - GridLayout

by 코젼 2022. 8. 2.
728x90
반응형

2022-08-02(31일차)


💡GridLayout

◾ rowCount가 중요하다.


 

◾ vertical 사용


◾ horizontal 사용


📃 그리드레이아웃 버튼 배치 예제

📝test7.xml

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:rowCount="3"
    android:columnCount="3"
    android:padding="30dp">

    <Button
        android:text="버튼 1"
        />
    <Button
        android:text="버튼 2"
        android:layout_column="2"
        />
    <Button
        android:text="버튼 3"
        android:layout_row="1"
        android:layout_column="1"
        />
    <Button
        android:text="버튼 4"
        android:layout_row="2"
        android:layout_column="0"
        />
    <Button
        android:text="버튼 5"
        android:layout_row="2"
        android:layout_column="2"
        />




</GridLayout>
728x90
반응형

댓글