Search code examples
androidtimepickerdialog

Android TimePickerDialog and DateTimePicker info is too small


My TimePickerDialog (Date too) is showing the time in very small format...

Dialog Too Small

I tried to create a custom theme, but it doesn't work either as I don't know what property to set.

<style name="DateAndTimePickerTheme" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">@color/colorPrimary</item>
    <item name="colorControlActivated">@color/colorPrimaryDark</item>
</style>

Solution

  • after a while I found how to solve this problem:

    You just need to set the textSize and buttonStyle:

    <style name="DatePickerTheme" parent="Theme.AppCompat.Light.Dialog">
            <item name="android:textSize">28sp</item>
            <item name="colorAccent">@color/colorPrimary</item>
            <item name="colorControlActivated">@color/colorPrimaryDark</item>
            <item name="buttonStyle">@style/DateAndTimePickerButtonTheme</item>
        </style>
    
        <style name="TimePickerTheme" parent="Theme.AppCompat.Light.Dialog">
            <item name="android:textSize">54sp</item>
            <item name="colorAccent">@color/colorPrimary</item>
            <item name="colorControlActivated">@color/colorPrimaryDark</item>
            <item name="buttonStyle">@style/DateAndTimePickerButtonTheme</item>
        </style>
    
        <style name="DateAndTimePickerButtonTheme" parent="Theme.AppCompat.Light">
            <item name="android:textSize">18sp</item>
            <item name="android:textColor">@color/colorPrimary</item>
        </style>
    

    I hope it help someone!