почему кнопки не заполняют все пространство

По горизонтали кнопки заполняют все отведенное пространство а по вертикали нет как это исправить ?

введите сюда описание изображения

<LinearLayout
            style="@style/ll">

            <Button
                android:text="5"
                style="@style/button_speid" />


            <Button
                android:text="10"
                style="@style/button_speid"/>


            <Button
                android:text="15"
                style="@style/button_speid"/>

        </LinearLayout>

        <LinearLayout
            style="@style/ll">
            <Button
                android:text="20"
                style="@style/button_speid" />


            <Button
                android:text="25"
                style="@style/button_speid"/>


            <Button
                android:text="40"
                style="@style/button_speid"/>
        </LinearLayout>

        <LinearLayout
            style="@style/ll">
            <Button
                android:text="60"
                style="@style/button_speid" />


            <Button
                android:text="70"
                style="@style/button_speid"/>


            <Button
                android:text="80"
                style="@style/button_speid"/>
        </LinearLayout>

    </LinearLayout>

//style


 <style name="button_speid">
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_weight">30</item>
        <item name="android:layout_margin">0dp</item>
        <item name="android:textSize">24dp</item>
    </style>

    <style name="ll">
        <item name="android:layout_height">0dp</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_weight">30</item>
    </style>

Ответы (1 шт):

Автор решения: Andrew

Попробуйте вот такой стиль для кнопки:

<style name="button_speid">
    <item name="android:padding">0dp</item>
    <item name="android:layout_height">match_parent</item>
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_weight">30</item>
    <item name="android:textSize">24dp</item>
    <item name="android:insetTop">0dp</item>
    <item name="android:insetBottom">0dp</item>
    <item name="android:minWidth">0dp</item>
    <item name="android:minHeight">0dp</item>
</style>

решение в этих строках:

android:insetTop="0dp"
android:insetBottom="0dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:padding="0dp"

и да, когда используете weight в виджете, например в родителе по ширине сумма весов 30, то у детей нужно ставить ширину чтобы этот параметр учитывался.

→ Ссылка