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>
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!
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.