android - 没有额外空间的项目

标签 android android-recyclerview

我的布局中有一个 recyclerview。 我的问题是 recyclerview 中的额外空间。 我怎样才能删除它? 这是我的代码:
回收项目:

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

<ImageView
    android:id="@+id/imgGalleryImage"
    android:layout_height="match_parent"
    android:layout_width="wrap_content"
    android:layout_margin="10dp"
    android:src="@drawable/slider1"
    xmlns:android="http://schemas.android.com/apk/res/android" />

回收 View :

    <android.support.v7.widget.RecyclerView
    android:id="@+id/photographerImageGalleryRecycler"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:scrollbars="horizontal"
    android:layout_centerInParent="true"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="10dp"
    android:visibility="visible"
    android:choiceMode="singleChoice" />

和代码:

        List<BundlePhotographerImageGallery> photographerImageGalleryList = new ArrayList<>();

    for (int i = 0; i < 20; i++) {
        BundlePhotographerImageGallery bundlePhotographerImageGallery = new BundlePhotographerImageGallery();
        bundlePhotographerImageGallery.image = "slider1";
        photographerImageGalleryList.add(bundlePhotographerImageGallery);
    }

    AdapterPhotographerImageGalleryRecycler adapterPhotographerImageGalleryRecycler = new AdapterPhotographerImageGalleryRecycler(photographerImageGalleryList, getApplicationContext());
    photographerImageGalleryRecycler.setLayoutManager(linearLayoutManager1);
    photographerImageGalleryRecycler.setAdapter(adapterPhotographerImageGalleryRecycler);

和图像: enter image description here

最佳答案

从 recycler view 和 imageview 中移除边距

关于android - 没有额外空间的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37938127/

相关文章:

android - Google Play Developer Console - 如何在其他国家/地区提供应用程序?

java - AdMob 窃取了 3 个像素?

Android - 覆盖 android 布局文件中的样式

android-recyclerview - 添加数据后 RecyclerView 不更新

java - 使用 glide 从服务器加载图像

android - 为什么 recyclerView 总是删除最后一项

android - 在 notifyDatasetChanged() 后 RecyclerView 闪烁

xml - 迁移到 androidx 后错误膨胀类 androidx.recyclerview.widget.RecyclerView

android - putExtras 多个 putString 不工作

android - 即使我在控制台中指定了包名称和 key 的 SHA-1 指纹,Google map android api 也无法在 Release模式下工作