Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does the extra space around my button come from?

Tags:

android

layout

I have a simple layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">
    <LinearLayout android:orientation="horizontal"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:padding="5dp"
                  android:id="@+id/acquiring_signal_layout">
        <ProgressBar android:id="@+id/ProgressBar01"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"/>
        <TextView android:id="@+id/acquiring_signal_label"
                  android:text="@string/acquiring_signal"
                  android:layout_width="fill_parent"
                  android:textAppearance="?android:attr/textAppearanceLarge"
                  android:layout_height="wrap_content"
                  android:layout_gravity="center_vertical"
                  android:paddingLeft="5dp"/>
    </LinearLayout>
    <com.google.android.maps.MapView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mapview"
        android:clickable="true"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:apiKey="..."
        android:layout_weight="1"/>
    <Button
        android:text="@string/send_button"
        android:id="@+id/SendButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
    </Button>
</LinearLayout>

It works fine, except when it renders, the button at the bottom appears to have several (roughly 5, I'd guess) pixels of black margin/space around it. Setting the margin of the button doesn't seem to have any affect. What's going on?

like image 378
Ken Kinder Avatar asked Jan 13 '11 15:01

Ken Kinder


1 Answers

This is from the drawables that are used for the background of the button. There are a couple pixels that are transparent in the button drawable. if you set the drawable to your own, you will notice there is no "empty space".

like image 89
Ryan Conrad Avatar answered Nov 15 '22 11:11

Ryan Conrad