使用网格布局管理器在recyclerview中显示每个行项目之间的大幅度空白

我有以下XML,可以使用网格布局管理器将其充实到Recyclerview中-

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:background="@color/white"
    android:orientation="vertical"
    android:padding="20dp">

    <ImageView
        android:id="@+id/products_row_item_product_image_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher" />

    <TextView
        android:id="@+id/products_row_item_product_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/fragment_marketplace_products_row_item_product_title"
        android:textSize="17sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/products_row_item_description_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/products_row_item_product_description" />

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/very_light_grey"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">


        <TextView
            android:id="@+id/products_row_item_price_text_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:text="@string/products_row_item_price_text"
            android:textStyle="bold" />

        <ImageView
            android:id="@+id/products_row_item_heart_image_view"
            android:layout_width="27dp"
            android:layout_height="27dp"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:scaleType="fitXY"
            android:src="@drawable/like_heart" />

        <TextView
            android:id="@+id/products_row_item_likes"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="end"
            android:text="@string/fragment_marketplace_products_row_item_likes"
            android:textSize="20sp" />
    </LinearLayout>
</LinearLayout>

我的手机上的XML看起来像这样-

使用网格布局管理器在recyclerview中显示每个行项目之间的大幅度空白

但是我想要实现的结果是UI具有更大的边距,使行项在其中“游动”。这是一个演示-

使用网格布局管理器在recyclerview中显示每个行项目之间的大幅度空白

所以我的问题如下-

1)如何更改XML文件以使其与所需文件相同? 2)如您所见,“心”和“赞”图标与价格标签粘在一起。我想像图片一样将它们分开。

hhqqhhhhqqhh 回答:使用网格布局管理器在recyclerview中显示每个行项目之间的大幅度空白

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3125921.html

大家都在问