I add datepicker to my application but my problem the shadow for the dialog have white background , use Android 21 for compile .
please help me to remove white background ...
You have a "bug" in your themes.xml
or styles.xml
material design support library is not working properly with dialogs.
So remove the specific dialog code or separate it in different versions.
Trying to explain a little bit further.
Generally when we extend the original application theme we have an themes.xml
and/or styles.xml
files under the values
folder. In there code you will find something like these:
Application theme:
<style name="MyTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!-- ... other styling values ... -->
<!-- Dialog attributes -->
<item name="dialogTheme">@style/MyTheme.Dialog</item>
<!-- AlertDialog attributes -->
<item name="alertDialogTheme">@style/MyTheme.Dialog</item>
<!-- ... other styling values ... -->
</style>
Custom dialog theme:
<style name="MyTheme.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
<!-- some styling values here -->
</style>
What needs customization is the parent
of the MyTheme.Dialog
this Theme.
AppCompat
.Light.Dialog
does not work properly for all android versions it may work for Lollipop but does not work for KitKat, or the opposite.
values-v21
and define the parent of the dialog accordingly, so that it work for both versions.You can apply some other workarounds regarding the customization of the style, in order for this to work.
If you would like further research, or theme customization ideas take a look at the source of android theme.xml here.