2

enter image description here

The red zone is scrollView, blue zone is floating action menu.

The problem is that I can't scroll if I touch on blue area.

I want to scroll scrollView anywhere, green zone or blue zone.

How can I resolve this problem.

This is xml file of MainActivity code.

<FrameLayout
    android:id="@+id/frameLayout"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="8">

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </android.support.v4.view.ViewPager>


    <com.github.clans.fab.FloatingActionMenu
        android:id="@+id/fam"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="16dp">

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_qr"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_menu_edit"
            app:fab_label="QR코드"/>

        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_address"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_menu_add"
            app:fab_label="연락처로 추가"/>


        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_id"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_menu_delete"
            app:fab_label="카카오톡 ID로 추가"/>


        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_recommend"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@android:drawable/ic_menu_delete"
            app:fab_label="추천친구"/>

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

</FrameLayout>

and code of viewPager

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="친구"/>

    <!--<ListView-->
        <!--android:id="@+id/listView"-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="match_parent">-->
    <!--</ListView>-->
    <com.example.kakaotalk3.NonScrollListView

        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </com.example.kakaotalk3.NonScrollListView>

</LinearLayout>
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
조광수
  • 23
  • 3

2 Answers2

0

Similar issue has been reported here already. Please have a look.

I am quoting the problem and the solution reported in that issue.

I find what cause this problem. In my code it was onClick listener for all fab_menu. It override all touches even when fab menu is closed. So if you need this listener, you need manually turn listener on when fab menu is open and turn listener off when it closed. After I remove listener fab menu works great.

Hence I would like to suggest to override the onMenuToggleListener like the following and disable the on click listeners on your fab buttons when the menu is in closed state.

fabMenu.setOnMenuToggleListener(new FloatingActionMenu.OnMenuToggleListener() {
    @Override
    public void onMenuToggle(boolean opened) {
        if (opened) {

        } else {

        }
    }
});

Hope that helps!

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
0

Make sure that you don't register click listener on fab menu

like - fabm.setOnClickListener(this);

if you register then remove it, Hopefully, it will work fine!