androiddatepickerdialog

How to change the year and summary text size in date picker dialog android


I have set

<item name="android:textSize">12sp</item>

in the style of the app [AppTheme].

As a consequence, the year label and the summary label in the date picker dialog has gone smaller. I am trying to edit the sizes of them.

enter image description here

I tried various solutions from StackOverflow. But, none of them worked for me. Instead, the calendar is covering the whole screen. Kindly help me with this issue.


Solution

  • You can use a custom theme for your date picker like this

      <style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog">
        <item name="colorAccent">@color/colorPrimary</item>
        <item name="android:textSize">25sp</item>
    </style>
    


    and your date picker dialog like this

     new DatePickerDialog(MapActivity.this, R.style.DialogTheme, new DatePickerDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                        //DO SOMETHING
                    }
                }, 2019, 11, 25).show();