Scrolling from left to right using the viewpager and navigation box

I have a viewpager and navigation box. Both actions do horizontal scrolling, but how can I control which one is responsible for the swipe action?

My viewer:

Fragment[] allPictures = new Fragment[getNrPictures()]; APicturePageAdapter adapter = new APicturePageAdapter(super.getSupportFragmentManager(), allPictures); vP = (ViewPager) findViewById(R.id.picPage); vP.setAdapter(adapter); 

Through scrolling from right to left, I can view the images. Works great. Then I added a navigation box:

 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/PicturePageContentLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="2dp" android:orientation="vertical" > ....... </LinearLayout> <LinearLayout android:id="@+id/left_drawer_ll" android:layout_width="300dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="@android:color/white" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <TextView ... content </TextView> </LinearLayout> 

Opening and closing the drawer works fine, everything seems to work. However, when I touch the drawer and sit down to the left, I want the drawer to close and not look to switch to the previous image. How can I control who is responsible for the onTouch event?

Thanks for any help.

+4
source share
1 answer

The only thing I know is using the droidux library.

http://www.youtube.com/watch?v=N0HNMK8xewE

0
source

Source: https://habr.com/ru/post/1494009/


All Articles