当前位置: 代码迷 >> Web前端 >> 两个webview点击有关问题
  详细解决方案

两个webview点击有关问题

热度:435   发布时间:2013-11-14 22:02:51.0
两个webview点击问题

有时候两个webview点击一个会影响另一个

ublic class MyWebView extends WebView{

    private MyActivity mActivity;

    //Call this on each webview in activity's onCreate after 
       
    public setActivity(MyActivity activity){
        mActivity = activity;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event){
        if (event.getAction()==ACTION_POINTER_DOWN && mActivity!=null){
            mActivity.onWebviewTouched(self);
        }
        super.onTouchEvent(event);
    }

}


public void onWebviewTouched(MyWebView webView) {
    if (webView == mWebviewLeft){
       
    } else if (webView == mWebviewRight) {
       
    }
}

?