Large gap between RecyclerView items

后端 未结 1 975
别跟我提以往
别跟我提以往 2021-01-20 11:23

after I run my application I get large gap between RecyclerView items !! this is my code here : Github Large gap between recyclerview items

相关标签:
1条回答
  • 2021-01-20 11:54

    Change your Layouts like this

    activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <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"
    tools:context="com.breuhteam.recyclerview.MainActivity">
    
    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />
    </RelativeLayout>
    

    view_item.xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/itemView"
        android:src="@drawable/diy"
        android:layout_margin="1dp"
        android:adjustViewBounds="true"/>
    </RelativeLayout>
    
    0 讨论(0)
提交回复
热议问题