-
[activity_main.xml] 6개버튼 가로로 두줄개발/Android 2019. 11. 5. 13:33반응형
<?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"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button2"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button3"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button4"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button5"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button6"
/>
</LinearLayout>
</LinearLayout>//////////////////////////////////////
layout 크기 지정
<?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"
android:orientation="vertical">
view size1 text의 크기에 맞게 지정.
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="VIEW SIZE1"
/>view size2 는 가로는 꽉차고,세로는 text크기에 맞게 지정
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="VIEW SIZE2"
/>view size3 는 가로,세로 모두 꽉채움(남는공간에 맞춰서)
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="VIEW SIZE3"
/>
</LinearLayout>반응형'개발 > Android' 카테고리의 다른 글
[덧셈계산기] (0) 2019.11.05 [activity_main.xml (0) 2019.11.05