I have a problem with Themes and Styles in Android when using different Android versions.
So the main problem is that I have a DialogFragment popping up at some point in the application and it contains an EditText
. The AlertDialog is created like this:
AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setPositiveButton ...
and the EditText is created and added like this:
editor = new EditText(getActivity());
dialog.setView(editor);
On my Lollipop device, the EditText
has a bottom line with my desired color. (c1 in the list below).
But on my Android 4.3 device, it has the standard ugly blue bottom line.
My application has an apptheme that defines (among others) these items:
<item name="colorPrimary">@color/c1</item>
<item name="colorPrimaryDark">@color/c2</item>
<item name="colorAccent">@color/c3</item>
<item name="colorControlNormal">@color/c1</item>
<item name="colorControlActivated">@color/c2</item>
<item name="colorControlHighlight">@color/c3</item>
The dialog fragments are started from an activity inheriting this app theme and I'm always using the regular getActivity() as Context.
So has anyone experienced this? I think it should automatically use the correct colors (through colorControlNormal, colorControlActivated and colorControlHighlight) but they are ignored.
I'm using appcompat 22.2.0
btw.
Thanks for any input on this!