【发布时间】:2021-10-01 02:30:32
【问题描述】:
我想以 CircleImageView 领先于 CardView 的方式显示输出
但我的输出看起来像这样
这是我想与 RecylerView 一起使用的单行 XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/backgroundColor">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleImageView"
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/cat_placeholder"
app:civ_border_color="@color/red"
app:civ_border_width="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="32dp"
app:cardElevation="50dp"
app:layout_constraintBottom_toBottomOf="@+id/circleImageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/circleImageView"
app:layout_constraintTop_toTopOf="@+id/circleImageView" />
</androidx.constraintlayout.widget.ConstraintLayout>
【问题讨论】:
-
将 imageview 和 cardview 包裹在框架布局中并使用边距重叠
-
我尽力了,谢谢
-
它不起作用@YashJoshi
-
CircleImageView的海拔低于50dp,因此您需要设置更高的海拔或使它们相同,但在 XML 中交换它们的声明。