Android TimePickerDialog 和 DateTimePicker 信息太少

Android TimePickerDialog and DateTimePicker info is too small

我的 TimePickerDialog(也是日期)以非常小的格式显示时间...

Dialog Too Small

我尝试创建一个自定义主题,但它也不起作用,因为我不知道要设置什么属性。

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

一段时间后我找到了解决这个问题的方法:

你只需要设置textSize和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>

希望对大家有所帮助!