在 Android 中,如何在使用主题时覆盖 EditText 长按弹出窗口以包含 "Clipboard" 选项?

In Android, how do I override EditText longpress popup to include "Clipboard" option when using a theme?

我使用 Android Asset Studio 创建了一个主题并应用了它 - 看起来很棒。

但是,现在当我长按我的 EditText 时,我只会将 "Paste" 选项显示为文本。如果没有应用主题,长按 EditText 会弹出功能更强大的 UI,显示粘贴 和剪贴板 。我必须有剪贴板选项。

我知道我可以创建自定义长按视图。但我希望能够简单地覆盖主题对原始长按行为的覆盖。

这里是一些截图...

有主题(不够好):

没有主题(我想要的):

这是主题样式文件中的代码:

<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator

     Copyright (C) 2011 The Android Open Source Project
     Copyright (C) 2012 readyState Software Ltd

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<resources>

    <style name="Theme.Ibgib_green" parent="@android:style/Theme.Holo">
        <item name="android:actionBarItemBackground">@drawable/selectable_background_ibgib_green</item>
        <item name="android:popupMenuStyle">@style/PopupMenu.Ibgib_green</item>
        <item name="android:dropDownListViewStyle">@style/DropDownListView.Ibgib_green</item>
        <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Ibgib_green</item>
        <item name="android:actionDropDownStyle">@style/DropDownNav.Ibgib_green</item>
        <item name="android:actionBarStyle">@style/ActionBar.Solid.Ibgib_green</item>
        <item name="android:actionModeBackground">@drawable/cab_background_top_ibgib_green</item>
        <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_ibgib_green</item>
        <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Ibgib_green</item>


    </style>

    <style name="ActionBar.Solid.Ibgib_green" parent="@android:style/Widget.Holo.ActionBar.Solid">
        <item name="android:background">@drawable/ab_solid_ibgib_green</item>
        <item name="android:backgroundStacked">@drawable/ab_stacked_solid_ibgib_green</item>
        <item name="android:backgroundSplit">@drawable/ab_bottom_solid_ibgib_green</item>
        <item name="android:progressBarStyle">@style/ProgressBar.Ibgib_green</item>
    </style>

    <style name="ActionBar.Transparent.Ibgib_green" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">@drawable/ab_transparent_ibgib_green</item>
        <item name="android:progressBarStyle">@style/ProgressBar.Ibgib_green</item>
    </style>

    <style name="PopupMenu.Ibgib_green" parent="@android:style/Widget.Holo.ListPopupWindow">
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_ibgib_green</item>   
    </style>

    <style name="DropDownListView.Ibgib_green" parent="@android:style/Widget.Holo.ListView.DropDown">
        <item name="android:listSelector">@drawable/selectable_background_ibgib_green</item>
    </style>

    <style name="ActionBarTabStyle.Ibgib_green" parent="@android:style/Widget.Holo.ActionBar.TabView">
        <item name="android:background">@drawable/tab_indicator_ab_ibgib_green</item>
    </style>

    <style name="DropDownNav.Ibgib_green" parent="@android:style/Widget.Holo.Spinner">
        <item name="android:background">@drawable/spinner_background_ab_ibgib_green</item>
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_ibgib_green</item>
        <item name="android:dropDownSelector">@drawable/selectable_background_ibgib_green</item>
    </style>

    <style name="ProgressBar.Ibgib_green" parent="@android:style/Widget.Holo.ProgressBar.Horizontal">
        <item name="android:progressDrawable">@drawable/progress_horizontal_ibgib_green</item>
    </style>

    <style name="ActionButton.CloseMode.Ibgib_green" parent="@android:style/Widget.Holo.ActionButton.CloseMode">
        <item name="android:background">@drawable/btn_cab_done_ibgib_green</item>
    </style>

    <!-- this style is only referenced in a Light.DarkActionBar based theme -->
    <style name="Theme.Ibgib_green.Widget" parent="@android:style/Theme.Holo">
        <item name="android:popupMenuStyle">@style/PopupMenu.Ibgib_green</item>
        <item name="android:dropDownListViewStyle">@style/DropDownListView.Ibgib_green</item>
    </style>

嗯,我不知道如何让弹出窗口正常工作。但我确实(可能)了解到为什么弹出窗口被简化为 "Paste" 而没有管理器选项。

在我的标准键盘 (Samsung S3/4/6) 上,有一个剪贴板按钮,可通过长按 space 栏左侧的按钮之一访问。这避免了弹出窗口本身对剪贴板管理器的要求。