android-floating-action-button icon indicating copy to clipboard operation
android-floating-action-button copied to clipboard

How to Expand floating button horizontally

Open Tejpandya opened this issue 9 years ago • 8 comments

i successfully open fab vertically but i need to open it horizontally , i don't know how to do that or even it is possible or not

Tejpandya avatar Dec 12 '16 13:12 Tejpandya

I have the same query.

Shanto16 avatar Apr 02 '17 21:04 Shanto16

me too,how?

t894924815 avatar Jun 28 '17 09:06 t894924815

you cant , because there is one property regrading open it horizontally or vertically , but it is not working properly .it'll trigger errors , So according to me . not possible.

Tejpandya avatar Jun 28 '17 09:06 Tejpandya

for horizontal... https://github.com/Clans/FloatingActionButton

abiemann avatar Jul 29 '17 23:07 abiemann

@abiemann This library doesn't support horizontal floating either.

Edit: the last version of this library supports horizontal expand. Proof: http://prntscr.com/g5s63g

nvasilev0101 avatar Aug 08 '17 07:08 nvasilev0101

you can set Expand floating button horizontally if you cancel the set of the attributes of labels fab:fab_labelsPosition and fab:fab_labelStyle

then ,you can set fab:fab_expandDirection="left"

pengjiawei avatar Jan 06 '18 03:01 pengjiawei

@pengjiawei please guide me a bit about it? I'm trying to do that from the last 2-3 days!

Ahsan221B avatar Jan 16 '18 09:01 Ahsan221B

<com.getbase.floatingactionbutton.FloatingActionsMenu
                android:id="@+id/float_menu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentEnd="true"
                android:layout_marginBottom="4dp"
                android:layout_marginEnd="4dp"
                fab:fab_addButtonColorNormal="@color/red"
                fab:fab_addButtonColorPressed="@color/red_pressed"
                fab:fab_addButtonPlusIconColor="@color/white"
                fab:fab_addButtonSize="normal"
                fab:fab_expandDirection="left"
                >		
            <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">
                <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textAlignment="center"
            android:text="your text"/>
                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/float_btn_1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:fab_colorNormal="@color/red"
                    fab:fab_colorPressed="@color/red_pressed"
                    fab:fab_icon="@drawable/your icon"
                    fab:fab_size="mini"
                     >
                </com.getbase.floatingactionbutton.FloatingActionButton>
            </LinearLayout>
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:textAlignment="center"
                    android:text="your text"/>
                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/float_btn_2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:fab_colorNormal="@color/red"
                    fab:fab_colorPressed="@color/red_pressed"
                    fab:fab_icon="@drawable/your_icon"
                    fab:fab_size="mini"
                     />
                </LinearLayout>
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:textAlignment="center"
                    android:text="your text"/>
                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/float_btn_3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    fab:fab_colorNormal="@color/red"
                    fab:fab_colorPressed="@color/red_pressed"
                    fab:fab_icon="@drawable/your_icon"
                    fab:fab_size="mini"
                     />
                </LinearLayout>
            </com.getbase.floatingactionbutton.FloatingActionsMenu>
```

this is my layout,you will see the layout like this ![floatingButton.png](http://upload-images.jianshu.io/upload_images/635586-f199441fa54dc2ed.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
and I added the textview in the floatingActionButton,you can delete it if you don't need them.

this is why I did it 
don't set the attributes of labels fab:fab_labelsPosition and fab:fab_labelStyle in FloatingActionsMenu

good luck to you~ @Ahsan221B 

pengjiawei avatar Jan 16 '18 10:01 pengjiawei