2013-11-24 97 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);