如何解决recyclerview 中的动态宽度和高度变化
<androidx.cardview.widget.CardView
android:id="@+id/listingHoursCardView"
android:layout_width="220dp"
android:layout_height="150dp"
app:cardCornerRadius="10dp"
app:cardElevation="6dp"
app:cardBackgroundColor="@color/rest_bg"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginEnd="16dp"
app:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/mealCatCover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@color/blue_dahboard"
app:layout_constraintTop_toTopOf="parent"
app:riv_corner_radius="10dip"
app:riv_mutate_background="true"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dark_effect_image_listing_details" />
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll_childItem"
app:cardCornerRadius="20dp"
app:cardUseCompatPadding="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:backgroundTint="@android:color/transparent">
<LinearLayout
android:id="@+id/ll_bg"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="@string/name"
android:id="@+id/tv_childCatName"
android:gravity="center"
android:maxLines="1"
android:layout_gravity="center"
android:textStyle="bold"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</androidx.cardview.widget.CardView>
这里的问题是当我单击该文本时,cardview 中的 textview 会更改其大小。单击时,我更改了其背景以显示选定的内容..它有时会缩小,有时会根据我猜的其他元素大小而放大。有人可以帮助我,cardview 应该总是以相同的大小包装内容。谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。