weightSum - 뷰의 높이 너비를 비율로 설정할 수 있게 해 줌 (단, orientation이 vertical인 경우 높이만 가능하고, horizontal의 경우 너비만 가능)

 

----------------------------------------

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="9">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        android:textSize="20sp"
        android:layout_weight="3">

    </TextView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="2"
        android:layout_weight="3">

    </TextView>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="3"
        android:textSize="20sp"
        android:layout_weight="3">

    </TextView>

</LinearLayout>

----------------------------------------

'안드로이드 앱 만들기' 카테고리의 다른 글

Fragment끼리 데이터 전송  (0) 2020.09.22
Card View  (0) 2020.09.21
Frame Layout (뷰 끼리 겹치기)  (0) 2020.09.20
Table Layout  (0) 2020.09.15
Check Box (옵션 선택 버튼)  (0) 2020.09.12
Posted by khon98
,