有没有办法检测WebView中链接和图像的长按?
答案 0 :(得分:9)
我查看了Browser.apk源代码,找到了我真正想要的内容:
public void onCreate(Bundle savedInstanceState) {
// ...
registerForContextMenu(descriptionWebView);
// ...
}
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
WebView.HitTestResult hitTestResult = descriptionWebView.getHitTestResult();
switch (hitTestResult.getType()) {
// ...
}
}