我在webview中实现了文本选择代码.它没有任何问题,工作得非常好.但我想打开自定义对话框而不是默认对话框.我使用它的链接在下面
如何覆盖android webview os 4.1+的默认文本选择?
但它不适用于自定义对话框.
找到下面的代码
public class CustomWebView extends WebView {
private Context context;
private ActionMode mActionMode;
private ActionMode.Callback mSelectActionModeCallback;
private GestureDetector mDetector;
public CustomWebView(Context context) {
super(context);
this.context = context;
WebSettings webviewSettings = getSettings();
webviewSettings.setJavaScriptEnabled(true);
// add JavaScript interface for copy
WebAppInterface webAppInterface = new WebAppInterface(context);
addJavascriptInterface(webAppInterface, "JSInterface");
}
public CustomWebView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
}
public CustomWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
}
// …Run Code Online (Sandbox Code Playgroud) :app:mergeDebugResources FAILED C:\ Users\abc\AndroidStudioProjects\MyApplication2\app\src\main\res\values-21错误:错误:资源目录名无效错误:任务':app:mergeDebugResources'的执行失败.
C:\ Users\abc\AndroidStudioProjects\MyApplication2\app\src\main\res\values-21:错误:资源目录名无效
我在finish()方法和finishAndRemoveTask()方法之间几乎没有混淆。如果有人对此有所了解,请解释它们之间的区别。