2013-05-29 71 views
1

我想打開一個網頁內的網頁視圖,它工作得很好,而且在4.1.2及以下版本,但當我在android 4.2中嘗試相同的代碼.2即nexus 4它沒有從鍵盤輸入任何信息。無法在nexus 4上的webview中輸入文本android 4.2.2

當我點擊網頁鍵盤上的任何編輯文本時,它都會打開,它也顯示編輯文本的焦點,但只要我按下任何字符鍵盤焦點從編輯文本中丟失,並且沒有任何字段被輸入。低是我的代碼

mWebView.getSettings().setJavaScriptEnabled(true); 
     mWebView.getSettings().setPluginState(PluginState.ON); 
     mWebView.getSettings().setAllowFileAccess(true); 
     mWebView.setWebViewClient(new MyWebViewClient()); 
     mWebView.clearHistory(); 
     mWebView.clearFormData(); 
     mWebView.clearCache(true); 
     mWebView.loadUrl(strUrl); 
     mWebView.requestFocus(); 


/** 
    * webview client 
    */ 
    private class MyWebViewClient extends WebViewClient { 
     @Override 
     // show the web page in webview but not in web browser 
     public boolean shouldOverrideUrlLoading(WebView view, String url) { 
      if (!getSuceessParams(url)) 
       view.loadUrl(url); 
      return true; 
     } 

     @Override 
     public void onReceivedHttpAuthRequest(WebView view, HttpAuthHandler handler, String host, String realm) { 
      handler.proceed("checkin", "4good"); 
     } 

     @Override 
     public void onPageFinished(WebView view, String url) { 
      System.out.println("onPageFinished " + url); 
      context.removeDialog(0); 
      super.onPageFinished(view, url); 
     } 

     @Override 
     public void onPageStarted(WebView view, String url, Bitmap favicon) { 
      System.out.println("onPageStarted " + url); 
      Fragment fragment = context.getLastFragment(); 
      if (fragment.getTag() == "campaign_donation_web_fragment") { 
       CheckinLibraryActivity.strProgressMessage = "Loading.."; 
       context.showDialog(0); 
      } 
      super.onPageStarted(view, url, favicon); 
     } 
    } 

我收到以下錯誤

****Should not happen: no rect-based-test nodes found 

感謝

回答

0

在我的情況TabHost從後面的堆棧中的前一個片段偷竊的重點是每個按鍵。以下是我固定它:

tabHost.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { 
    @Override 
    public void onViewDetachedFromWindow(View v) {} 

    @Override 
    public void onViewAttachedToWindow(View v) { 
    tabHost.getViewTreeObserver().removeOnTouchModeChangeListener(tabHost); 
    } 
}); 

更多的話題見https://code.google.com/p/android/issues/detail?id=2516

相關問題