android - scrollview inside viewpager not scrolling -
i have small vertical scrollview inside viewpager horizontal swippable pages. problem not able scroll through pages swiping horizontally on scrollview. want able swipe horizontally on scrollview scroll through viewpager's pages , have function swipe vertically scroll through scrollview's contents.
i don´t know if it's same case, had similar problem have described. have looked everywhere find answer: https://stackoverflow.com/a/35180360/1969966.
basically, if activity structure above example:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" android:elevation="4dp" android:theme="@style/themeoverlay.appcompat.actionbar" app:popuptheme="@style/themeoverlay.appcompat.light"/> <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/toolbar" android:background="?attr/colorprimary" android:elevation="6dp" android:minheight="?attr/actionbarsize" app:tabmode="fixed" android:theme="@style/themeoverlay.appcompat.dark.actionbar"/> <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/toolbar" tools:context="net.voidynullness.android.tabitytabs.tablayoutactivity" android:background="#ffffff"/> </android.support.design.widget.appbarlayout> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_info"/> </android.support.design.widget.coordinatorlayout>
change (look "android.support.design.widget.appbarlayout"):
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" android:elevation="4dp" android:theme="@style/themeoverlay.appcompat.actionbar" app:popuptheme="@style/themeoverlay.appcompat.light"/> <android.support.design.widget.tablayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/toolbar" android:background="?attr/colorprimary" android:elevation="6dp" android:minheight="?attr/actionbarsize" app:tabmode="fixed" android:theme="@style/themeoverlay.appcompat.dark.actionbar"/> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/toolbar" tools:context="net.voidynullness.android.tabitytabs.tablayoutactivity" android:background="#ffffff"/> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_info"/> </android.support.design.widget.coordinatorlayout>
now, you'll able swipe horizontally , vertically!
Comments
Post a Comment