有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

Android/Java页边距位于左/右/底部

如何从按钮上删除这些边距

https://i.stack.imgur.com/UBPhR.png

我想要100%宽度的按钮:/

我的活动xml:

<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
xmlns:tools="http://schemas.安卓.com/tools"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:paddingLeft="0dp"
tools:context="${relativePackage}.${activityClass}" >

<Button
    安卓:id="@+id/button1"
    安卓:layout_width="fill_parent"
    安卓:layout_height="wrap_content"
    安卓:layout_alignParentBottom="true"
    安卓:layout_alignParentLeft="true"
    安卓:layout_marginBottom="34dp"
    安卓:backgroundTint="#1379ff" />

<Button
    安卓:id="@+id/Button01"
    安卓:layout_width="fill_parent"
    安卓:layout_height="wrap_content"
    安卓:layout_alignParentBottom="true"
    安卓:layout_alignParentLeft="true"
    安卓:backgroundTint="#313131" />

    安卓:layout_alignParentLeft="true"
    安卓:layout_weight="1"
    安卓:text="Button" />


共 (1) 个答案

  1. # 1 楼答案

    RelativeLayout中,你应该使用fill_parent 也许这是因为它的父宽度