Extra padding/margin added to DatePicker on Android 7.1.1
Add Style with AlertDialog.Builder
like as follow.
AlertDialog.Builder builder = new AlertDialog.Builder(UserAttributesActivity.this, android.R.style.Theme_DeviceDefault_Light_Dialog_NoActionBar);
@Ankita is right, but if you are using AppCompat things are a bit more involved:
Define a new style and extend AppCompat's Light.Dialog
style
<style name="DatePickerDialogStyle" parent="@style/Theme.AppCompat.Light.Dialog">
...
</style>
Then add attributes to mimic the NoActionBar
part:
<style name="DatePickerDialogStyle" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Lastly, now that you are no longer getting app compat colors from your AppTheme
, copy them over to your new theme:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
<style name="DatePickerDialogStyle" parent="@style/Theme.AppCompat.Light.Dialog">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">@color/primary<item>
<item name="colorPrimaryDark">@color/primary_darkitem>
<item name="colorAccent">@color/accent</item>
</style>
Then apply this new theme:
AlertDialog.Builder builder
= new AlertDialog.Builder(UserAttributesActivity.this,
DatePickerDialogStyle);