Closed Back4fire closed 3 years ago
Thanks.
Thanks.
how come you closed this? I haven't fixed it π
I thought the MD team doesn't treat it as a bug.π But it's unreasonable to make the style of MaterialButton in BottomSheetDialog like that in AlertDialog. We usually put complicated UI in BottomSheetDialog.
I thought the MD team doesn't treat it as a bug.π But it's unreasonable to make the style of MaterialButton in BottomSheetDialog like that in AlertDialog. We usually put complicated UI in BottomSheetDialog.
Yeah, I agree
Yes, it's working as designed.
If you want to change the button style, you can extend ThemeOverlay.MaterialComponents.BottomSheetDialog and override ?attr/MaterialButtonStyle to the style you like, and set your main theme's ?attr/bottomSheetDialogTheme to the custom theme.
MaterialButton in BottomSheetDialog will be forced to single-line. With the Layout Inspector, I found singleLine==ture and maxLines==1. But I never set these values explicitly. The bug starts from Material 1.4.0. And still exists in 1.5.0-alpha02.
The following is a very simple layout, a Button in a FrameLayout.
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="300dp">
This screenshot is compiled with Material 1.3.0. Everything is correct.
This screenshot is compiled with Material 1.4.0. The Button is single-line.
SourceCode.zip
The layouts in my project related to this bug are broken. If there is any workaround before it can be fixed, please let me know.