首页 > 解决方案 > 从 Android RelativeLayout 中删除填充和边距

问题描述

生成的布局之间的空间

我已经尝试了一切,但无法弄清楚如何删除每个块之间的空格。它们是由用户输入生成的集合,因此代码用于模板

<LinearLayout
    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:textAlignment="center"
    android:gravity="center_horizontal"
    android:weightSum="100"
    android:layout_margin="0dp"
    android:paddingBottom="0dp"
    android:paddingTop="0dp"
    android:layout_marginBottom="-20dp"
    android:divider="@null"
    android:dividerHeight="0dp"
    xmlns:xmls="http://schemas.android.com/apk/res-auto">

标签: javaandroidxmllayoutformatting

解决方案


最好的解决方案是,如果您将 recyclerview 与适配器一起使用。这是一个很好的教程。显然,在相对布局部分,您需要使用包装内容并匹配父级。


推荐阅读