Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Holo Light with Dark Actionbar showing Holo Dark copy and paste icons

so I have an app that is Holo Light with Dark Actionbar and whenever I go to copy and paste something in an EditText, the icons are white so you can't see them. A screenshot is located below. Is there any way to remedy this? Thanks!A screenshot of the bug

like image 235
ollien Avatar asked Oct 04 '22 10:10

ollien


2 Answers

You have to manually set the theme again in the onCreateDialog method. It is a bug in the framework but this workaround works for the time being:

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

like image 128
Basant Singh Avatar answered Oct 11 '22 04:10

Basant Singh


I have this problem with Theme.AppCompat.Light.DarkActionBar theme and I think it's a bug. I tried to change the background in my style with the following (you can get the drawables from 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>

And with this:

<!-- 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>

But none of this solutions appears to work (please let me know if you finally get to change the background) so I decided to let the white background and just change the icons:

<!-- 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>

Note: You need to specify a styles.xml file in values, values-v11 and values-v14 because some attributes are not necesary added with or without the 'android' preffix. Check the documentation for API level: http://developer.android.com/reference/android/R.attr.html#actionModeCopyDrawable

like image 39
Fede Avatar answered Oct 11 '22 04:10

Fede