Skip to content

Commit 93de754

Browse files
committed
Chore: Improve my_view_holder.xml using ConstraintLayout
Signed-off-by: imknown <imknown@qq.com>
1 parent 7befe34 commit 93de754

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

  • app/src/main/java/net/imknown/android/forefrontinfo/ui/base/list/res/layout

app/src/main/java/net/imknown/android/forefrontinfo/ui/base/list/res/layout/my_view_holder.xml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,44 @@
1111
tools:layout_marginHorizontal="@dimen/item_divider_space_horizontal"
1212
tools:layout_marginTop="@dimen/item_divider_space_vertical">
1313

14-
<LinearLayout
14+
<androidx.constraintlayout.widget.ConstraintLayout
1515
android:layout_width="match_parent"
1616
android:layout_height="wrap_content"
17-
android:orientation="vertical"
1817
android:paddingHorizontal="@dimen/item_card_padding"
1918
android:paddingVertical="@dimen/item_card_padding">
2019

21-
<RelativeLayout
22-
android:layout_width="match_parent"
20+
<TextView
21+
android:id="@+id/tvTitle"
22+
android:layout_width="0dp"
2323
android:layout_height="wrap_content"
24-
android:orientation="horizontal">
25-
26-
<TextView
27-
android:id="@+id/tvTitle"
28-
android:layout_width="match_parent"
29-
android:layout_height="wrap_content"
30-
android:textColor="?attr/colorOnSurface"
31-
android:textDirection="locale"
32-
android:textSize="20sp"
33-
android:textStyle="bold"
34-
tools:text="@string/android_info_title" />
24+
android:textColor="?attr/colorOnSurface"
25+
android:textDirection="locale"
26+
android:textSize="20sp"
27+
android:textStyle="bold"
28+
app:layout_constraintEnd_toEndOf="parent"
29+
app:layout_constraintStart_toStartOf="parent"
30+
app:layout_constraintTop_toTopOf="parent"
31+
tools:text="@string/android_info_title" />
3532

36-
<com.google.android.material.imageview.ShapeableImageView
37-
android:id="@+id/sivColor"
38-
android:layout_width="16sp"
39-
android:layout_height="16sp"
40-
android:layout_alignParentEnd="true"
41-
app:shapeAppearanceOverlay="@style/Circle"
42-
tools:background="@color/colorNoProblem" />
43-
</RelativeLayout>
33+
<com.google.android.material.imageview.ShapeableImageView
34+
android:id="@+id/sivColor"
35+
android:layout_width="16sp"
36+
android:layout_height="16sp"
37+
app:layout_constraintEnd_toEndOf="parent"
38+
app:layout_constraintTop_toTopOf="@+id/tvTitle"
39+
app:shapeAppearanceOverlay="@style/Circle"
40+
tools:background="@color/colorNoProblem" />
4441

4542
<TextView
4643
android:id="@+id/tvDetail"
47-
android:layout_width="match_parent"
44+
android:layout_width="0dp"
4845
android:layout_height="wrap_content"
4946
android:textColor="?attr/colorOnSurfaceVariant"
5047
android:textDirection="locale"
5148
android:textSize="16sp"
49+
app:layout_constraintEnd_toEndOf="parent"
50+
app:layout_constraintStart_toStartOf="parent"
51+
app:layout_constraintTop_toBottomOf="@+id/tvTitle"
5252
tools:text="@string/android_info_detail" />
53-
</LinearLayout>
53+
</androidx.constraintlayout.widget.ConstraintLayout>
5454
</com.google.android.material.card.MaterialCardView>

0 commit comments

Comments
 (0)