从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">

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

最新更新