Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why don't buttons have the same baseline in LinearLayout

Here is my XML file

<LinearLayout
    android:weightSum="3"
    android:layout_width="match_parent"
    android:layout_height="128dp"
    android:orientation="horizontal">

    <Button
        android:id="@+id/button3"
        style="@style/Base.Widget.AppCompat.Button.SoundboardUnlockedButton"
        android:layout_weight="1"
        android:text="Butto1111111111111111111n" />

    <Button
        style="@style/Base.Widget.AppCompat.Button.SoundboardUnlockedButton"
        android:id="@+id/button2"
        android:layout_weight="1"
        android:text="Butt1111111111111111on" />

    <Button
        android:id="@+id/button"
        style="@style/Base.Widget.AppCompat.Button.SoundboardUnlockedButton"
        android:layout_weight="1"
        android:text="Bu111111111111111111tton" />
</LinearLayout>

Style Base.Widget.AppCompat.Button.SoundboardUnlockedButton

<style name="Base.Widget.AppCompat.Button.SoundboardUnlockedButton">
    <item name="android:layout_width">0dp</item>
    <item name="android:layout_height">128dp</item>
</style>

Here you can see that Buttons don't have the same baseline, how do I fix this? enter image description here

like image 911
Аяз Хуснутдинов Avatar asked Sep 01 '25 10:09

Аяз Хуснутдинов


1 Answers

Put this in your LinearLayout:

android:gravity="center_vertical"

to align the buttons