I am creating an ExpandableListView and its adapter (ExpandableListAdapter, using a SimpleExpandableListAdapter) by doing something like this. It works fine in light mode, but the text remains black in dark mode / night mode, while the rest of my application is styled correctly:
ExpandableListAdapter adapter = new SimpleExpandableListAdapter(
activity.getApplicationContext(),
groupData, groupLayout, groupFrom, groupTo,
childData, childLayout, childFrom, childTo);
ExpandableListView expandableListView = view.findViewById(R.id.my_expandable_list_view);
expandableListView.setAdapter(adapter);
Instead of passing in activity.getApplicationContext() as the context argument when creating the SimpleExpandableListAdapter, pass in the activity directly. The theme on the application context appears to be wrong:
ExpandableListAdapter adapter = new SimpleExpandableListAdapter(
activity /* instead of activity.getApplicationContext() */,
groupData, groupLayout, groupFrom, groupTo,
childData, childLayout, childFrom, childTo);
Though others recommend using a RecyclerView instead of a ListView/ExpandableListView.
Credit to this reddit post by u/TheCrazyRed.