Open
Description
Description: Scaling Calendar dialog for tablet
Expected behavior:
It is actually too small in tablet (just didn't capture the whole screen) and the dialog padding has issue which can be seen when looking at the buttons
Source code: The code snippet which is causing this issue
<style name="DialogButtonStyle" parent="Widget.Material3.Button.TextButton.Dialog" tools:keep="@style/DialogButtonStyle">
<item name="android:textSize">24sp</item>
<item name="android:textColor">@color/colorPrimaryDark_Accent</item>
</style>
<!-- DatePicker theme on both light and night mode -->
<style name="AppCalendar" parent="@style/ThemeOverlay.Material3.MaterialCalendar" tools:keep="@style/AppCalendar">
<!-- Background color -->
<item name="colorSurface">@color/colorWhite_Primary</item>
<!-- Indicator or focused field color -->
<item name="colorPrimary">@color/colorPrimary_Accent</item>
<!-- Day color (active) -->
<item name="colorOnPrimary">@color/colorWhite_PrimaryDark</item>
<!-- Day color (inactive) -->
<item name="colorOnSurface">@color/colorPrimaryDark_White</item>
<!-- Remove unnecessary overlay -->
<item name="elevationOverlayEnabled">false</item>
<item name="colorOnSurfaceVariant">@color/colorPrimary_Accent</item>
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyle</item>
<item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyle</item>
<item name="materialAlertDialogTitleTextStyle">@style/DialogTitleStyle</item>
<item name="materialAlertDialogBodyTextStyle">@style/DialogBodyStyle</item>
<item name="shapeAppearanceCornerExtraLarge">@style/ShapeAppearance.App.LargeComponent</item>
</style>
<!-- AlertDialog theme on both light and night mode -->
<style name="AppDialog" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog" tools:keep="@style/AppDialog">
<!-- Background color -->
<item name="colorSurface">@color/colorWhite_Primary</item>
<!-- Message color -->
<item name="colorOnSurfaceVariant">@color/colorPrimaryDark_White</item>
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyle</item>
<item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyle</item>
<item name="alertDialogStyle">@style/MaterialAlertDialog.App</item>
<item name="materialAlertDialogTitleTextStyle">@style/DialogTitleStyle</item>
<item name="materialAlertDialogBodyTextStyle">@style/DialogBodyStyle</item>
</style>
<style name="MaterialAlertDialog.App" parent="MaterialAlertDialog.Material3" tools:keep="@style/MaterialAlertDialog_App">
<item name="shapeAppearance">@style/ShapeAppearance.App.MediumComponent</item>
<item name="shapeAppearanceOverlay">@null</item>
</style>
<!-- This may sometimes ignore when title is too long and too large that it does not fit in one line -->
<!-- Reference: https://github.com/material-components/material-components-android/issues/3014#issue-1404665319 -->
<style name="DialogTitleStyle" parent="@style/MaterialAlertDialog.MaterialComponents.Title.Text">
<item name="android:textColor">@color/colorPrimaryDark_White</item>
<item name="android:textAllCaps">true</item>
<item name="android:textSize">40sp</item>
</style>
<style name="DialogBodyStyle" parent="@style/MaterialAlertDialog.MaterialComponents.Body.Text">
<item name="android:textColor">@color/colorPrimaryDark_White</item>
<item name="android:textSize">18sp</item>
</style>
Here I was hoping that materialAlertDialogTitleTextStyle
and materialAlertDialogBodyTextStyle
will took effect just like in normal alert dialog.
Minimal sample app repro: N/A
Android API version: 21 and above
Material Library version: 1.10.0
Device: Pixel C Emulator