[FloatingActionButton] App crashes because of shapeAppearance on FAB
See original GitHub issueDescription: Here is the Demo app https://github.com/ashraf-patel/MaterialComponentsDemo, as described in this link to the gif you can reproduce the crash.
Expected behavior: It should not crash.
Source code:
Here is the problem, making cornerSizeTopRight and cornerSizeBottomLeft to 30dp is causing the crash. link to the Gif
<style name="ShapeAppearance.Sunflower.FAB" parent="ShapeAppearance.MaterialComponents">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopLeft">0dp</item>
<item name="cornerSizeTopRight">30dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">30dp</item>
</style>
Below code works link to the gif
<style name="ShapeAppearance.Sunflower.FAB" parent="ShapeAppearance.MaterialComponents">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopLeft">0dp</item>
<item name="cornerSizeTopRight">0dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
</style>
https://github.com/ashraf-patel/MaterialComponentsDemo is the Demo app.
Android API version: OS: 8.0
Material Library version: 1.1.0-beta01
Device: Device: Pixel 2 XL Emulator
StackOverflow: https://stackoverflow.com/questions/58225921/shapeappearance-in-material-component-floatingactionbutton-causes-a-crash
Issue in original repository: https://github.com/android/sunflower/issues/519
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
shapeAppearance in Material Component ...
Using shapeAppearance attribute causes a crash. This is the FAB in XML <com.google.android.material.floatingactionbutton.FloatingActionButton ...
Read more >[FloatingActionButton] View is crashing the preview [130710290]
I cannot upload the app since it is IP of the company, but something as simple as just the FAB inside a Coordinator...
Read more >Theming Floating Action Buttons in Android with Example
Floating Action Button (FAB) in Android with Example ... Otherwise, the app will crash immediately as soon as we launch the application.
Read more >Buttons: floating action button - Material Design
A floating action button (FAB) performs the primary, or most common, action on a screen. It appears in front of all screen content,...
Read more >Add a Floating Action Button - Android Developers
A floating action button (FAB) is a circular button that triggers the primary action in your app's UI. This page shows you how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Resolved by 3c3ac61
My bad the corner can be more than 50% since the other one on the same side is 0.
@gabrielemariotti It repros in 26.
I’ll have to debug this tomorrow setting app:shapeAppearanceOverlay=“@null” seems to help, which doesn’t make sense to me since the ShapeAppearance in the example is setting the more specific cornerSizes. The default fab overlay only sets
app:cornerSize
to 50% the shape appearance should ignore the overlay in this case.