简体   繁体   English

如何摆脱元素周围的默认白色“空格”?

[英]how to get rid of default white “space” around an element?

Here is my code 这是我的代码

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
   >
   <TextView android:id="@+id/label"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:text="email"
      />
   <EditText
       android:id="@+id/inputEmail"
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"
       android:layout_below="@id/label"

       />
   <Button 
       android:id="@+id/btnLogin"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_below="@id/inputEmail"
       android:layout_alignParentLeft="true"
       android:padding="0dp"
       />

</RelativeLayout>

And the output: http://imgur.com/Ga322Q6 并输出: http : //imgur.com/Ga322Q6

I researched the definition of padding to be "space inside the border, between the border and the actual view's content" and is " inside of a View"( Difference between a View's Padding and Margin ) I initially thought the white space was padding(inside the blue-border) and played around with it. 我将填充的定义研究为“边界内,边界与实际视图内容之间的空间”和“视图内部”( 视图的填充和边距之间的差异 ),我最初以为空白是填充(内部)蓝色边框)并随身携带。 However no matter the padding, the white space was still there. 但是,无论填充如何,空白仍然存在。 Does anyone know how to get rid of this white space or what its called? 有谁知道如何摆脱这个空白或所谓的空白?

It is the default button padding you are seeing you cant do anything about it, but you can still put a drawable background to your button so the padding will disappear. 这是您看到的default button padding ,您无法对其执行任何操作,但仍可以在按钮上放置可绘制的背景,以便填充消失。

solution: 解:

add background to the button so it wont have padding within it. 在按钮上添加背景,使其不会在其中填充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM