AlertDialog.Builder with undue space

2

I have a space in the bottom of my custom AlertDialog. I do not know why it's happening, knowing that I did not set any margins or padding at the end of my view. If anyone can help.

Here is a real print of what is happening

Andhere'smyusedcode...

<?xmlversion="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:background="#5454C3">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="15dp"
        android:paddingBottom="5dp"
        android:background="#FF33CC">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="7dp" >

            <br.lgfelicio.elementos.TextViewChanged
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#9B9B9B"
                android:textSize="12sp"
                android:text="DESTINO" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="4dp"
            android:id="@+id/editTextFiltroRegiao">

            <Spinner
                android:id="@+id/spnEstadoFretes"
                android:layout_width="fill_parent"
                android:layout_marginTop="-14dp"
                android:layout_height="wrap_content"/>

        </LinearLayout>

    </LinearLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#C0C1C0"
        android:layout_marginTop="-15dp"
        android:layout_marginLeft="7dp"
        android:visibility="visible"/>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="15dp"
        android:paddingBottom="5dp"
        android:background="#00FF00">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="7dp" >

            <br.lgfelicio.elementos.TextViewChanged
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#9B9B9B"
                android:textSize="12sp"
                android:text="COMPLEMENTO" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="4dp"
            android:id="@+id/editTextFiltroComplemento">

            <Spinner
                android:id="@+id/spnComplemento"
                android:layout_width="fill_parent"
                android:layout_marginTop="-14dp"
                android:layout_height="wrap_content"/>

        </LinearLayout>

    </LinearLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#C0C1C0"
        android:layout_marginTop="-15dp"
        android:layout_marginLeft="7dp"
        android:visibility="visible"/>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingTop="15dp"
        android:paddingBottom="5dp"
        android:background="#FF0000">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="7dp" >

            <br.lgfelicio.elementos.TextViewChanged
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#9B9B9B"
                android:textSize="12sp"
                android:text="PREÇO" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginTop="4dp"
            android:id="@+id/editTextFiltroPreco">

            <Spinner
                android:id="@+id/spnPreco"
                android:layout_marginTop="-14dp"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"/>

        </LinearLayout>

    </LinearLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#C0C1C0"
        android:layout_marginTop="-15dp"
        android:layout_marginLeft="7dp"/>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginTop="5dp"
        android:paddingTop="10dp"
        android:layout_marginLeft="7dp"
        android:background="#000000">

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <br.lgfelicio.elementos.TextViewChanged
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/progresTexto"
                android:textColor="#9B9B9B"
                android:textSize="12sp"
                android:text="RAIO" />

        </LinearLayout>

        <SeekBar
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="4dp"
            android:id="@+id/raioSeekBar"/>

    </LinearLayout>

</LinearLayout>

Resolved!

The problem is that I was using layout_marginTop negative, and somehow, the layout did not recalculate the height, because the element went up, but pro layout it remains there in the same position.

I was like this ...

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="#C0C1C0"
    android:layout_marginTop="-19dp"/>

When I removed -19, the space on the bottom disappeared. And then when I put the View inside a LinearLayout, I was able to put negative margin without having the space problem at the end.

Now it's like this ...

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#C0C1C0"
        android:layout_marginTop="-9dp"/>

</LinearLayout>

Solved. Thank you for your help! Thanks.

    
asked by anonymous 14.09.2015 / 20:52

1 answer

1

Remove this line from Linear Layout

android:layout_marginLeft="7dp"

line 157

    
17.09.2015 / 15:18