[英]Tabs in ViewPager inside vertical ScrollView won't scroll verticaly
我在ViewPager中有垂直ScrollView内的标签。 水平滑动成功执行。 当我尝试垂直滑动时,没有任何反应。
FragmentActivity布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/background_all_screen">
<RelativeLayout
android:id="@+id/RelativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border_white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:id="@+id/llButtons">
<Button
android:id="@+id/btnBack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/all"
android:onClick="onClickAll"
style="@style/button.blue"
android:layout_weight="1" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/llButtons"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="48dip"
style="@style/PagerSlidingTabStrip"
app:pstsShouldExpand="true"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</LinearLayout>
可能我在ScrollView和ViewPager之间存在冲突。
使用片段中的ScrollViews的UPDATE解决方案很不错,但我想要这样的东西:
用户无法在第二个屏幕截图中看到标签内容。
你真的需要在scrollview中有一个视图寻呼机吗? 我的建议是使用scrollviews作为viewpager片段的布局容器。
我认为你应该以这种方式改变你的布局:
因为你在scrollView中没有任何小部件,我认为你的片段布局中的所有内容都会将滚动视图移动到您发送到viewpager并将其作为根的每个片段的布局。 所以这样每个片段都会垂直滚动,你也可以通过viewpager来改变它们。
希望有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.