A sentimental robot

GridLayout 본문

Android Studio

GridLayout

GOD03219 2018. 2. 5. 11:40

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.i310_54.myapplication08.MainActivity"
>

<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

 

 


android:columnCount="3"
android:rowCount="2"
>

<Button android:text="1" />
<Button android:text="1" />
<Button android:text="1" />
<Button android:text="1" />
<Button android:text="1" />
<Button android:text="1" />

</GridLayout>


</LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.i310_54.myapplication08.MainActivity"

>

<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="3"
android:rowCount="2"
>

<Button android:text="1" android:layout_row="0" android:layout_column="0"/>
<Button android:text="1" android:layout_row="0" android:layout_column="1"/>
<Button android:text="1" android:layout_row="0" android:layout_column="2"/>
<Button android:text="1" android:layout_row="1" android:layout_column="0"/>
<Button android:text="1" android:layout_row="1" android:layout_column="1"/>
<Button android:text="1" android:layout_row="1" android:layout_column="2"/>

</GridLayout>


</LinearLayout>

 * android:layout_row 와 column은 필수 속성은 아니지만 그 부분(ex.0,1)만 지우고 싶을때 주석 잡고 쓰임 

'Android Studio' 카테고리의 다른 글

Handler  (0) 2018.02.05
GridLayout2  (0) 2018.02.05
배경색 자동으로 바꾸기  (0) 2018.02.01
TableLayout  (0) 2018.02.01
Transmission  (0) 2018.01.31