From 1e27aef9e7e2d228cacb6de65c84bd7fc76d6ae5 Mon Sep 17 00:00:00 2001 From: Willi Ye Date: Mon, 29 Mar 2021 18:23:01 +0200 Subject: [PATCH] Properly constraint width in linear layout --- app/src/main/res/layout/app_item_linear.xml | 80 +++++++++++---------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/app/src/main/res/layout/app_item_linear.xml b/app/src/main/res/layout/app_item_linear.xml index 522e8f09..7ba8089d 100644 --- a/app/src/main/res/layout/app_item_linear.xml +++ b/app/src/main/res/layout/app_item_linear.xml @@ -1,45 +1,53 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/item_click_layout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:clickable="true" + android:focusable="true" + android:padding="16dp"> + android:id="@+id/icon" + android:layout_width="50dp" + android:layout_height="50dp" + android:contentDescription="@string/icon" + android:focusable="false" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:src="@drawable/default_icon" /> + android:id="@+id/text_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="10dp" + android:ellipsize="end" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceListItem" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toTopOf="@+id/text_subtitle" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/icon" + app:layout_constraintTop_toTopOf="parent" + tools:text="Title" /> + android:id="@+id/text_subtitle" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="10dp" + android:textAppearance="?android:attr/textAppearanceListItemSecondary" + android:textColor="@android:color/tertiary_text_light" + app:layout_constrainedWidth="true" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/icon" + app:layout_constraintTop_toBottomOf="@+id/text_title" + tools:text="SubTitle" />