android - 白色上下文菜单(复制/粘贴)

标签 android android-edittext uri clipboard copy-paste

我希望能够从 EditText 框中复制文本。这就是现在的样子,我没有找到复制突出显示文本的选项(在顶部栏中)。如何以最简单的方式启用它?

enter image description here

最佳答案

我从主题中更改了案例中的图标:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.ituTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ....
       
        <item name="android:actionModeCutDrawable">@drawable/cut</item>
        <item name="actionModeCutDrawable">@drawable/cut</item>
        <item name="android:actionModeCopyDrawable">@drawable/copy</item>
        <item name="actionModeCopyDrawable">@drawable/copy</item>
        <item name="android:actionModePasteDrawable">@drawable/paste</item>
        <item name="actionModePasteDrawable">@drawable/paste</item>
        <item name="android:actionModeSelectAllDrawable">@drawable/select_all</item>
        <item name="actionModeSelectAllDrawable">@drawable/select_all</item>
         ...
    </style>
</resources>

复制、剪切、粘贴、全选

copy cut paste select_all

关于android - 白色上下文菜单(复制/粘贴),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29678590/

相关文章:

android - 如何将 ListView 保持在 Frame Layout 底部

android - 如何使用 appcompat 设置 View 样式

android - 为什么加速度计与重力传感器的用电量不同?

Android:如何验证 EditText 输入?

Android:当键盘出现时如何滚动 ScrollView 以显示下一个字段

android - 在 android 棉花糖上获取 realPath 返回 null?

android - 根据安卓版本加载不同的 View

android - 如何在 EditText 上启用默认复制粘贴

java - 如何将 "jar:file"URI 转换为 Jar 文件的路径?

c# - 当密码或用户名字段包含特殊字符时,System.Uri 无法解析