android - Programmatic MotionEvents are highlighting content in my webview
问题描述
I'm using pretty standard code I found on here to programmatically trigger a click, (say for instance I want to click on a link) on my android WebView but it only highlights content at the specified x,y coordinates.
long when = SystemClock.uptimeMillis();
float pressure = 1.0f;
int action = 0;
int source = MotionEvent.ACTION_UP;
MotionEvent event = MotionEvent.obtain(when, when + 50, action, x, y, pressure, 1.0f, 0, 1.0f, 1.0f, 0, 0);
event.setSource(source);
mWebView.dispatchTouchEvent(event);
I'm very new at Android programming so I may be missing something obvious, any ideas?
解决方案
推荐阅读
- webhooks - 使用 Zapier webhooks 到 google 表格的 Webflow
- node.js - 如何修复nodejs中的意外令牌错误firebase部署
- excel - “UseRWHlinkNavigation”阻止 excel 超链接在浏览器中打开
- python - 多维数组的 Numba 实现非常慢
- delphi - 如何停靠存储在 DLL 或其他应用程序中的表单
- node.js - 在回调中使用 multer
- node.js - nodejs中的异步等待mongodb查询不起作用
- javascript - 在 javascript 中从 MongoDB 数据库中检索数据
- pandas - 为某个列值分组行
- django - 无法在 django 中保存 ManyToMany 字段?