I have an AppCompatActivity
with a layout that contains a single FrameLayout
. In that FrameLayout
, I place a Fragment that contains a more complex layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/top_toolbar" />
<android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/bottom_toolbar" />
<com.passionusnetworks.lype.plugins.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/abc_action_bar_default_height_material"
android:background="#00000000"
android:elevation="2dp" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF" />
<include layout="@layout/navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
And then I place 2 Fragment
in the ViewPager
. With my SlidingTabLayout
, I can switch between my 2 fragments by pressing on those tabs. In those fragments, there is a RecyclerView
. My problem is that no touch event seems to reach my fragments (the RecyclerView
s cannot scroll and I cannot swipe between the fragments of the ViewPager
. I've tried to put some OnTouchListener
on all levels but I could never get a single MotionEvent
.
I don't know what to do to find why I can't get any touch events in my fragments. Does someone have a suggestion?