<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/mIvIcon"
android:layout_width="@dimen/dp100"
android:layout_height="@dimen/dp100"
android:src="@mipmap/ic_launcher"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/mTvName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="这个是长文本这个是长文本这个是长文本"
app:layout_constraintBottom_toBottomOf="@id/mIvIcon"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toRightOf="@id/mIvIcon"
app:layout_constraintRight_toLeftOf="@id/mTvTag"
app:layout_constraintTop_toTopOf="@id/mIvIcon"
app:layout_constraintWidth_default="wrap" />
<TextView
android:id="@+id/mTvTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp10"
android:text="这个是标签"
android:textColor="@color/black"
android:textSize="@dimen/sp18"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/mIvIcon"
app:layout_constraintLeft_toRightOf="@id/mTvName"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/mIvIcon" />
</androidx.constraintlayout.widget.ConstraintLayout>
效果图:
8FF66606-FF0B-41EF-A2F2-D93E661E5D0F.png
网友评论