2013-11-24 99 views
0

我可以在長時間按下時選擇文字,但是當長時間點擊圖片時它不會顯示另存爲選項。試過所有的解決方案,但沒有得到結果。我已經在stackoverflow.com上嘗試過解決方案,但不適合我。 我試過下面的東西通過webView保存圖像..?

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { 
    // Confirm the view is a webview 
    if (v instanceof WebView) {     
     WebView.HitTestResult result = ((WebView) v).getHitTestResult(); 

     if (result != null) { 
      int type = result.getType(); 

      // Confirm type is an image 
      if (type == WebView.HitTestResult.IMAGE_TYPE || type == WebView.HitTestResult.SRC_IMAGE_ANCHOR_TYPE) { 
       String imageUrl = result.getExtra(); 
       Toast.makeText(this, imageUrl, Toast.LENGTH_LONG).show(); 

      } 
     } 
    } 
} 

回答

1

是你用registerForContextMenu()?

試試這個

activity.registerForContextMenu(webView);