1
我试图在我的cordova-plugin中禁用contextmenu很长一段时间,但是甚至没有找到解决问题的好方法。如何禁用Android的上下文菜单
我想我不得不以某种方式初始化我的cordova-plugin时从活动中覆盖“onCreateContextMenu”方法。但我不知道如何正确覆盖它。
公共类ContextMenuPlugin扩展CordovaPlugin {
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
//when overriding the onCreateContextMenuListener in View I gets executed, but nothing happens (maybe it's the wrong View?)
webView.getView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
//when logging something in here it is written when the context menu is created
//but i cannot seem to be able to modify the menu variable
}
});
super.initialize(cordova, webView);
}
}
如果这种观点是错误的看法,也许我不得不重写CordovaWebView以修改在web视图参考覆盖活动Activity中的“onCreateActionMode”方法。但CordovaWebView是一个接口,没有类,我不想实现整个接口,我不认为这是必要的。
如果有人对此有任何意见,请让我知道。