Scrollview里面的viewpager滚动垂直不起作用

时间:2015-12-28 09:45:39

标签: android android-viewpager scrollview

下面是我的代码,但它无法正常工作,想要一个带有scrollview的viewpager。滚动浏览滚动视图不起作用,面临最近2小时的问题而没有得到解决方案。请帮助我紧急。无法解决此问题我尝试添加嵌套的scrollview但它也无法正常工作。

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

1 个答案:

答案 0 :(得分:1)

如果您的视图寻呼机是用于更改页面选项卡而不是在子片段中使用horizo​​natl scroll,则每个视图首先获取父事件。您可以将页面内容排列为垂直并使用垂​​直滚动视图。 或者第二个选项,你必须为视图寻呼机禁用滑动事件,并且只有选项卡点击用于更改页面,而不是使用水平滚动视图。

相关问题