Home > Software engineering >  Is it possible to change the font size of the header in the Material Datepicker component on Android
Is it possible to change the font size of the header in the Material Datepicker component on Android

Time:08-15

My team wants me to change the font size of the Material Datepicker title to be more visible for accessibility reasons on Android. Is it possible and how?

enter image description here

CodePudding user response:

Yes you can change the size of Title.

Material Date Picker uses this theme

 <style name="MaterialCalendarTheme" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
    <!-- just override the colors used in the default style -->
    <item name="colorOnPrimary">@color/white</item>
    <item name="colorPrimary">@color/spruce_valencia</item>
    <item name="materialCalendarHeaderTitle">@style/date_text_appearance</item>

</style>

<style name="date_text_appearance" parent="@style/TextAppearance.AppCompat">
    <item name="android:textSize">@dimen/text_xlarge_heading</item>
</style>

materialCalendarHeaderTitle is what dies the trick and rest you can change the use textSize attribute to change the Text Size.

Here is how it looks

More about Material Date Picker attributes and layouts you can trace back this google material repo.

  • Related