简体   繁体   中英

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

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.

solution:

add background to the button so it wont have padding within it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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