Shakil Mahmud Shanto
Shakil Mahmud Shanto

Reputation: 545

Floating Action Menu in Horizontal Direction

I am new to android development and I am using this library for my FABs and FAB menus. All the expansion of FABs in this library are vertical. But I want a horizontal expanding of FAB menu items. How do I do that ??

library

Upvotes: 1

Views: 3297

Answers (2)

rafsanahmad007
rafsanahmad007

Reputation: 23881

Try using this Library

it has a horizontal orientation for floating action menu.

in Gradle:

compile 'it.sephiroth.android.library.floatingmenu:floatingmenu:1.0.1'

in code:

 FloatingActionMenu mFloatingMenu = new FloatingActionMenu
            .Builder(this)
            .addItem(item1)
            .withScrollDelegate(new FloatingActionMenu.AbsListViewScrollDelegate(mListView))
            .withThreshold(R.dimen.float_action_threshold)
            .withGap(R.dimen.float_action_item_gap)
            .withHorizontalPadding(R.dimen.float_action_h_padding)
            .withVerticalPadding(R.dimen.float_action_v_padding)
            .withGravity(FloatingActionMenu.Gravity.CENTER_HORIZONTAL | FloatingActionMenu.Gravity.BOTTOM)
            .withDirection(FloatingActionMenu.Direction.Horizontal)
            .animationDuration(300)
            .animationInterpolator(new OvershootInterpolator())
            .visible(visible)
            .build();

    mFloatingMenu.setOnItemClickListener(this);

this is the orientation line:

.withDirection(FloatingActionMenu.Direction.Horizontal)

or:

.withDirection(FloatingActionMenu.Direction.Vertical)

This is another library which can be used:

https://github.com/futuresimple/android-floating-action-button

Upvotes: 3

UPDATE: The Library has no support for horizontal expanding. Source

There is a parameter for opening direction:

fab:menu_openDirection="up"

fab:menu_openDirection="down"

You can find it in the documentation you give.

Usage like this:

<com.github.clans.fab.FloatingActionMenu
    android:id="@+id/menu"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    fab:menu_openDirection="up">

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/menu_item"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_star"
        fab:fab_size="mini"
        fab:fab_label="Menu item 1" />

</com.github.clans.fab.FloatingActionMenu>

But I couldn't see any left or right direction. You can ask this question to library's developer.

Upvotes: 1

Related Questions