在recyclerview中两个元素之间的空间

时间:2017-06-03 18:37:26

标签: android android-recyclerview

我为列表创建了一个recyclerview。 列表的两个元素之间存在一些不需要的空间。我没有为空间做任何事情。

xml中的Recyclerview代码:

<android.support.v7.widget.RecyclerView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/rv_content_list"
            android:layout_centerHorizontal="true"
            android:layout_below="@+id/collapsing_layout"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
             />

原始布局代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <TextView
            android:id="@+id/tv_raw_header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="25sp"
            android:textColor="#000"
            android:text=""
            android:gravity="center|left"
            />

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:layout_marginTop="10dp"
        android:visibility="visible">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <ImageView
                android:id="@+id/iv_raw_image"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="visible"
                />

            <VideoView
                android:visibility="visible"
                android:id="@+id/vv_raw_video"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#fff"/>

            <TextView
                android:id="@+id/tv_raw_caption"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentStart="true"
                android:gravity="center|right"
                android:textColor="#fff"
                android:layout_marginRight="10dp"
                android:layout_marginBottom="10dp"
                />
        </RelativeLayout>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        >

        <TextView
            android:id="@+id/tv_raw_info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#1e1e1e"
            android:layout_marginRight="3dp"
            android:layout_marginLeft="3dp"
            android:text=""/>

    </LinearLayout>

</LinearLayout>

输出图片:enter image description here

AS image:

now i have set black color to whole b ackground。

如何删除那个空间??

0 个答案:

没有答案
相关问题