如何在 Android 中长按自定义 webview 文本选择选项(例如复制、共享、全选)?

时间:2021-05-23 09:53:24

标签: java android webview

在我的 Android 原生 项目中,我使用 webview 来加载 html。在那个屏幕中,我允许用户长按文本选择来执行操作。因此,它具有如下图所示的默认操作-

enter image description here

enter image description here

为了添加一个名为“new”的自定义选项,我在清单文件中添加了以下意图过滤器-

 <intent-filter>
                <action android:name="android.intent.action.PROCESS_TEXT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>

而且,在我的 Java Activity 类中,我添加了以下代码-

CharSequence text = getIntent()
                .getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);

所以,现在的问题是,我想从默认设置中删除“复制、共享、全选、网络搜索”选项,而不是我想要添加自定义选项。

我需要一个解决方案来删除上面提到的默认选项并添加多个自定义选项,就像我只添加了一个一样。

0 个答案:

没有答案
相关问题