Android 移除 RelativeLayout 中的默认边距 [英] Android Remove default margins in RelativeLayout

查看:29
本文介绍了Android 移除 RelativeLayout 中的默认边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何去除RelativeLayout中元素的默认间距?

How to remove default spacing for elements in RelativeLayout?

我尝试设置负边距和权重属性,但没有得到任何结果.

I have tried setting negative margins, and weight property, but not getting any results.

我正在尝试删除该空间,以便我的 ListView 行没有垂直长度.

I am trying to remove that space so that I do not have that vertical length of my ListView row.

这个人正在做类似的事情,这是我遇到的第二个问题,但是负边距的方法不起作用.如何减少填充围绕 Android xml 布局中的文本?

This guy was doing something similar, which is second problem I have, but that approach with negative margins is not working. How do I reduce the padding around text in Android xml layout?

如何删除那个空格?

单元格 XML 的更短版本:

Shorter version of the cell XML:

<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/OrderRows"
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical">

<RelativeLayout
    style="?commonRowStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_marginStart="0sp"
        android:layout_marginEnd="0sp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/orderStatus"
            style="?orderParameterStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:includeFontPadding="false"
            android:text="@string/orderStatusSuspendedMobile"
            android:textSize="@dimen/textSizeSecondary" />

        <TextView
            android:id="@+id/filled"
            style="?orderParameterStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:includeFontPadding="false"
            android:text="filled"
            android:textSize="10sp" />
    </LinearLayout>
</RelativeLayout>

推荐答案

删除此样式

    style="?commonRowStyle"

这篇关于Android 移除 RelativeLayout 中的默认边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆