Java 有时滚动时,RecyclerView会创建边距

Java 有时滚动时,RecyclerView会创建边距,java,android,xml,android-layout,Java,Android,Xml,Android Layout,RecyclerView创建的边距只有在上下滚动后才会显示。并非所有项目都会发生这种情况,但总是发生在同一项目上 编辑:我用黑色圆圈标记的边距比绿色圆圈大。它应该在每个项目之间都有相同的空间 这是我的xml代码 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_wid

RecyclerView创建的边距只有在上下滚动后才会显示。并非所有项目都会发生这种情况,但总是发生在同一项目上

编辑:我用黑色圆圈标记的边距比绿色圆圈大。它应该在每个项目之间都有相同的空间

这是我的xml代码

<RelativeLayout
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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context="com.mangolassi.norman.steller.MessageRoomActivity">

<android.support.v7.widget.RecyclerView

    android:id="@+id/messageRecyclerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/linearLayout"/>

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:orientation="horizontal">

    <EditText
        android:id="@+id/messageEditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"/>

    <Button
        android:id="@+id/sendButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:enabled="false"
        android:text="SEND"/>

</LinearLayout>

下面是xml项

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="horizontal">

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

        <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/userAvatar"
            android:layout_width="46dp"
            android:layout_height="46dp"
            android:layout_marginLeft="10dp"
            android:src="@mipmap/default_avatar"
            />

        <TextView
            style="@style/incomingMessage"
            android:id="@+id/messageTextView"
            android:text="bsp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />

    </LinearLayout>
    <TextView
        style="@style/outgoingMessage"
        android:id="@+id/messageTextView2"
        android:text="bsp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>
</LinearLayout>


我正在使用最新的Android Studio

你在说什么利润率?我在截图中添加了一些符号。每个项目列表之间的间距并不总是相同的。项目的
xml
似乎无效:
LinearLayout
标记从不关闭。粘贴时错过了它。修正了这个问题的xml。