Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Custom viewpager for horizontal swiping #9601

Merged
merged 1 commit into from
Jul 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

public static class MapFragmentAdapter extends FragmentPagerAdapter {
static class MapFragmentAdapter extends FragmentPagerAdapter {

private static int NUM_ITEMS = 3;

public MapFragmentAdapter(FragmentManager fragmentManager) {
MapFragmentAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.mapbox.mapboxsdk.testapp.view;

import android.content.Context;
import android.support.v4.view.PagerTabStrip;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.SurfaceView;
import android.view.View;

public class MapViewPager extends ViewPager {

public MapViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}

@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
return v instanceof SurfaceView || v instanceof PagerTabStrip || (super.canScroll(v, checkV, dx, x, y));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.view.ViewPager
<com.mapbox.mapboxsdk.testapp.view.MapViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand All @@ -17,6 +17,6 @@
android:paddingBottom="4dp"
android:paddingTop="4dp"/>

</android.support.v4.view.ViewPager>
</com.mapbox.mapboxsdk.testapp.view.MapViewPager>

</RelativeLayout>