Ken Kinder
Ken Kinder

Reputation: 13140

Where does the extra space around my button come from?

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?

Upvotes: 5

Views: 1820

Answers (2)

Matt
Matt

Reputation: 3847

Have you tried setting a negative margin for the button?

Upvotes: 0

Ryan Conrad
Ryan Conrad

Reputation: 6900

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".

Upvotes: 6

Related Questions