java – How to change the background color of the context Menu-ThrowExceptions

Exception or error:

I Created a Darkmode for my App, but can’t make the ContextMenu dark.

My code:

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    // Get the web view hit test result
    final WebView view = this.findViewById(R.id.webView2);
    final WebView.HitTestResult result = view.getHitTestResult();

    if (result.getType() == WebView.HitTestResult.EDIT_TEXT_TYPE) {

    }
}

I tried this (style.xml)

<style name="LightTheme" parent="AppTheme">
    <item name="android:dropDownListViewStyle">@style/AppTheme.DropDownList</item>

</style>
<style name="AppTheme.DropDownList" parent="Widget.AppCompat.ListView.DropDown">
    <item name="android:background">#000000</item>
</style>

This ContextMenu is White. I want a black Version of this…
Can someone helps me?
Thanks.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *