ViewPager内部的ScrollView垂直滚动不起作用 [英] Scrollview inside viewpager scroll vertical not working

查看:59
本文介绍了ViewPager内部的ScrollView垂直滚动不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码,但是它不能正常工作,想要一个在所有片段中都带有scrollview的viewpager.滚动视图的滚动无法正常工作,从最近的2个小时开始遇到问题,并且没有解决方案.请帮助我解决此问题.我无法解决此问题,因此我尝试添加嵌套的滚动视图,但它也无法正常工作.

Below is my code but its not working properly, want a viewpager with scrollview in all fragment. Scrolling of the scrollview is not working,facing problem from last 2 hrs and not getting a solution.Please help me its urgent.Not able to solve this issue i tried adding nested scrollview but it is also not working.

<?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">

<LinearLayout
    android:id="@+id/toolbar_ll"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar_myjeenees"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:background="@android:color/white"
        android:minHeight="?attr/actionBarSize">

        <TextView
            android:id="@+id/toolbarShuffle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Shuffle Money"
            android:textColor="@color/black"
            android:textSize="18sp" />

    </android.support.v7.widget.Toolbar>
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:text="UserName"
            android:textSize="25sp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="5dp"
            android:text="May 15,Birthday" />

    </LinearLayout>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginRight="10dp"
        android:background="@mipmap/ic_forward" />
</LinearLayout>


<com.android.jeenees.utils.CustomScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:fillViewport="true"
    >

    <android.support.v4.view.ViewPager
        android:id="@+id/shufflePager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white" />
</com.android.jeenees.utils.CustomScrollView>
<!--</LinearLayout>-->

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <ImageButton
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@color/colorPrimary"
        android:padding="10dp"
        android:src="@mipmap/ic_action_tick" />

    <ImageButton
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@color/colorPrimary"
        android:padding="10dp"
        android:src="@mipmap/ic_back" />
</LinearLayout>

<?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:fillViewport="true"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_margin="10dp"
    android:layout_weight="1"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:fillViewport="true">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/firstwish"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="IPhone 5s" />

                    <View
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/costfirst"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Rs 5300/32777" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <SeekBar
                        android:id="@+id/seekfirst"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:max="100"
                        android:maxHeight="10dp"
                        android:progress="50"
                        android:progressDrawable="@drawable/progress_draw"
                        android:splitTrack="false"
                        android:thumb="@mipmap/ic_thumb"></SeekBar>
                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/secondwish"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="IPhone 5s" />

                    <View
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/costsecond"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Rs 5300/32777" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <SeekBar
                        android:id="@+id/seeksecond"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:max="100"
                        android:maxHeight="10dp"
                        android:progress="50"
                        android:progressDrawable="@drawable/progress_draw"
                        android:splitTrack="false"
                        android:thumb="@mipmap/ic_thumb"></SeekBar>
                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/thirdwish"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="IPhone 5s" />

                    <View
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <TextView
                        android:id="@+id/costthird"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Rs 5300/32777" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:orientation="vertical">

                    <SeekBar
                        android:id="@+id/seekthird"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:max="100"
                        android:maxHeight="10dp"
                        android:progress="50"
                        android:progressDrawable="@drawable/progress_draw_red"
                        android:splitTrack="false"
                        android:thumb="@mipmap/ic_red_thumb"></SeekBar>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.5"
        android:gravity="center"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:padding="10dp"
            android:text="Rs 1700"
            android:textSize="25sp" />


        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:padding="10dp"
            android:text="Released Money"
            android:textSize="25sp" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/colorPrimary"
                android:drawableLeft="@mipmap/ic_actin_add"
                android:gravity="center"
                android:padding="15dp"
                android:text="Top Up"
                android:textColor="@android:color/white" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

推荐答案

如果视图分页器水平滚动以更改页面选项卡,则每个视图都首先发生父事件,而不是不能在子片段中使用Horizo​​ntall滚动.您可以将页面内容排列为垂直方向并使用垂直滚动视图,这不是书面实践. 或者,第二种选择是您必须禁用视图寻呼机的滑动事件,并且仅使用制表符单击才能更改页面,而不能使用水平滚动视图.

Each view take parent event first if your view pager is swipe horizonatly for change the page tab than you can not use horizonatl scroll in child fragment . It is not write practice you can arrange your page content as vertical and use vertical scroll view. Or second option you will have to disable swipe event for view pager and only tab click is uesd to change page than you can use horizontal scroll view.

这篇关于ViewPager内部的ScrollView垂直滚动不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆