【发布时间】:2016-09-13 18:19:30
【问题描述】:
在我运行我的应用程序后,我发现 RecyclerView 项目之间的差距很大! 这是我的代码:Github Large gap between recyclerview items
【问题讨论】:
-
分享你的xml文件
标签: android xml android-recyclerview
在我运行我的应用程序后,我发现 RecyclerView 项目之间的差距很大! 这是我的代码:Github Large gap between recyclerview items
【问题讨论】:
标签: android xml android-recyclerview
像这样改变你的布局
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>
【讨论】: