小编Ana*_*ani的帖子

在webview的文本选择上打开自定义对话框

我在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)

android dialog textselection webview contextual-action-bar

10
推荐指数
0
解决办法
618
查看次数

在添加values-21文件夹后尝试构建项目并显示错误

: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:错误:资源目录名无效

android android-resources build.gradle

5
推荐指数
1
解决办法
3123
查看次数

finish() 和 finishAndRemoveTask() 的区别

我在finish()方法和finishAndRemoveTask()方法之间几乎没有混淆。如果有人对此有所了解,请解释它们之间的区别。

android android-lifecycle

-3
推荐指数
1
解决办法
3680
查看次数