Change EditText long click menu text color

Viewed 164

For some reason the menu that comes up on long click (for copy/paste/cut/etc...) in my EditText have white text color on a white background so it's unreadable.

Context menu for EditText

I searched quite a lot on this forum but haven't found answer that would have worked so far, I have also tried adding a custom popup style for the base theme as well as for the EditText style with colorAccent, color and textColor changed, like this:

<style name="Base.AppTheme" parent="Theme.AppCompat.NoActionBar">   
    <!-- Tried all 3 separately -->
    <item name="android:popupMenuStyle">@style/CustomPopup</item>
    <item name="popupMenuStyle">@style/CustomPopup</item>
    <item name="popupTheme">@style/CustomPopup</item>
</style>

<style name="Style.Input.EditText" parent="Widget.AppCompat.EditText">
    <!-- Tried all 3 separately -->
    <item name="android:popupMenuStyle">@style/CustomPopup</item>
    <item name="popupMenuStyle">@style/CustomPopup</item>
    <item name="popupTheme">@style/CustomPopup</item>
</style>

<style name="CustomPopup" parent="Widget.AppCompat.Light.PopupMenu">
    <item name="android:colorAccent">#000000</item>
    <item name="android:color">#000000</item>
    <item name="android:textColor">#000000</item>
</style>

Unfortunately it did not work.

Does anyone know of a way to customise this menu, the text color in particular?

1 Answers

Check the theme style

<item name="android:background">#FFFFFF</item>

It's highly likely that you have it set to WHITE and the text is already being set to WHITE. I would comment out this line where you're setting the background color and see if you can't figure it out from there. This was my issue.

Related