Viewpage 和 WebView的冲突

Viewpage 和 WebView的冲突_第1张图片

public class ExtendedWebView extends WebView {
    public ExtendedWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
public boolean canScrollHorizontally(int direction) {
    final int offset = computeHorizontalScrollOffset () ;

    final int range = computeHorizontalScrollRange () - computeHorizontalScrollExtent() ;

    if ( range == 0 ) return false ;

    else return ( direction < 0 ) ? ( offset > 0 ) : ( offset < range - 1 ) ;
}

}

Viewpage 和 WebView的冲突_第2张图片

@Override
    protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
        WebView view = (ExtendedWebView) v.findViewById (R.id.nomal_link_web); //res ID

    if ( view != null ) {

        return view.canScrollHorizontally ( -dx ) ;

    } else {

        return super.canScroll ( v, checkV, dx, x, y ) ;

    }
}

你可能感兴趣的:(Android)