<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    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:id="@+id/product_detail_root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >    <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollview_product"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:descendantFocusability="blocksDescendants"
        android:fillViewport="true"
        android:scrollbars="none">        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:orientation="vertical">            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/y680">                <android.support.v4.view.ViewPager
                    android:id="@+id/viewPager"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/y680"></android.support.v4.view.ViewPager>                <View
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/y48"
                    android:layout_alignBottom="@+id/viewPager"
                    android:alpha="0.3"
                    android:background="@drawable/icon_gradient_bg"/>                <LinearLayout
                    android:id="@+id/indicator"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/viewPager"
                    android:layout_marginBottom="@dimen/y16"
                    android:gravity="center_horizontal"
                    android:orientation="horizontal">                </LinearLayout>
            </RelativeLayout>            <com.github.lzyzsd.jsbridge.BridgeWebView
                android:id="@+id/product_webviiew"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
            </com.github.lzyzsd.jsbridge.BridgeWebView>        </LinearLayout>
    </ScrollView>
    <TextView
        android:id="@+id/tvBuyItNow"
        android:layout_width="match_parent"
        android:layout_height="@dimen/y84"
        android:layout_centerVertical="true"
        android:layout_gravity="bottom"
        android:background="@color/btn_redlight"
        android:clickable="true"
        android:focusable="false"
        android:gravity="center"
        android:text="立即购买"
        android:textColor="@color/white"
        android:textSize="14sp"/></FrameLayout>

解决方案 »

  1.   

    你重写ScrollView类
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        final float x = ev.getX();
        final float y = ev.getY();    final int action = ev.getAction();
        switch (action) {
            case MotionEvent.ACTION_DOWN:
                mDownPosX = x;
                mDownPosY = y;            break;
            case MotionEvent.ACTION_MOVE:
                final float deltaY = Math.abs(y - mDownPosY);
                // 这里是够拦截的判断依据是左右滑动,读者可根据自己的逻辑进行是否拦截
                if (deltaY > 5) {
                    return false;
                }
        }    return super.onInterceptTouchEvent(ev);
    }