hoang8f / android-flat-button

FButton - a flat button library for Android
Apache License 2.0
1.4k stars 327 forks source link

Very strange button movement in LinearLayout #12

Open magx2 opened 10 years ago

magx2 commented 10 years ago

In attached layout I tried to have 3 buttons in one line with the same width. So I used LinearLayout with layout_weight. The problem is when I press one of these buttons all of them moves little down.

Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="horizontal">

    <info.hoang8f.widget.FButton
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="1"/>

    <info.hoang8f.widget.FButton
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="2"/>

    <info.hoang8f.widget.FButton
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="3"/>

</LinearLayout>
hoang8f commented 10 years ago

hi @magx2 I still don't know the reason of this bug, but if you use android:gravity="center_vertical" the bug is gone. like this:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical"
        android:orientation="horizontal">

        <info.hoang8f.widget.FButton
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="1"/>

        <info.hoang8f.widget.FButton
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="2"/>

        <info.hoang8f.widget.FButton
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="3"/>

    </LinearLayout>
baoxituo1 commented 9 years ago

I have the same problem

luizfp commented 8 years ago

Same problem!