5

所以我有一个应用程序,它是带有深色操作栏的 Holo Light,每当我在 EditText 中复制和粘贴某些内容时,图标都是白色的,所以你看不到它们。屏幕截图位于下方。有没有办法解决这个问题?谢谢!错误截图

4

2 回答 2

3

您必须在 onCreateDialog 方法中再次手动设置主题。这是框架中的一个错误,但此解决方法暂时有效:

https://stackoverflow.com/a/19746561/1508506

于 2013-11-02T20:35:43.170 回答
1

我对 Theme.AppCompat.Light.DarkActionBar 主题有这个问题,我认为这是一个错误。我尝试使用以下方法更改我的风格的背景(您可以从http://jgilfelt.github.io/android-actionbarstylegenerator/获取可绘制对象):

<!-- styles.xml -->
<style name="Theme.MyThemeLightBase" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="actionModeBackground">@drawable/cab_background_top</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top</item>
</style>

有了这个:

<!-- styles.xml -->
<style name="Theme.MyThemeLightBase" parent="@style/Theme.AppCompat.Light.DarkActionBar">
    <item name="actionModeStyle">@style/my_action_mode_style</item>
    <item name="android:actionModeStyle">@style/my_action_mode_style</item>
</style>
<style name="my_action_mode_style" parent="@style/Widget.AppCompat.Light.ActionMode.Inverse">
    <item name="android:background">@drawable/cab_background_top</item>
</style>

但是这些解决方案似乎都不起作用(如果您最终可以更改背景,请告诉我)所以我决定让白色背景并只更改图标:

<!-- styles.xml -->
<style name="Theme.MyThemeLight" parent="Theme.MyThemeLightBase">
    <item name="actionModeSelectAllDrawable">@drawable/ic_menu_selectall_holo_light</item>
    <item name="android:actionModeSelectAllDrawable">@drawable/ic_menu_selectall_holo_light</item>
    <item name="actionModeCutDrawable">@drawable/ic_menu_cut_holo_light</item>
    <item name="android:actionModeCutDrawable">@drawable/ic_menu_cut_holo_light</item>
    <item name="actionModeCopyDrawable">@drawable/ic_menu_copy_holo_light</item>
    <item name="android:actionModeCopyDrawable">@drawable/ic_menu_copy_holo_light</item>
    <item name="android:actionModePasteDrawable">@drawable/ic_menu_paste_holo_light</item>
    <item name="actionModePasteDrawable">@drawable/ic_menu_paste_holo_light</item>
</style>

注意:您需要在 values、values-v11 和 values-v14 中指定一个 styles.xml 文件,因为有些属性不需要添加或不添加 'android' 前缀。检查 API 级别的文档:http: //developer.android.com/reference/android/R.attr.html#actionModeCopyDrawable

于 2013-10-03T12:36:34.160 回答