반응형
layout_constraintHorizontal_weight
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".MainActivity">
<TextView
android:id="@+id/text1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="text1"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/text2"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="text2"
app:layout_constraintHorizontal_weight="2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/text3"
app:layout_constraintLeft_toRightOf="@+id/text1"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="text3"
app:layout_constraintHorizontal_weight="3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toRightOf="@+id/text2"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
반응형
'# 02 > Android' 카테고리의 다른 글
[Android] ConstraintLayout 8 - 세로 3개 배치 (0) | 2019.08.14 |
---|---|
[Android] ConstraintLayout 7 - 세로 2개 배치 (0) | 2019.08.14 |
[Android] ConstraintLayout 5 - layout_constraintHorizontal_bias (0) | 2019.08.14 |
[Android] ConstraintLayout 4 - layout_constraintHorizontal_chainStyle (0) | 2019.08.14 |
[Android] ConstraintLayout 3 - 가로 3개 배치 (0) | 2019.08.14 |