[MaterialButton] android:elevation alway use default value
See original GitHub issueExpected behavior:
android:elevation
works for MaterialButton even not applying a style.
Source code: NOT WORK
<com.google.android.material.button.MaterialButton
android:layout_height="64dp"
android:layout_width="64dp"
android:elevation="20dp"" />
WORK
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_height="64dp"
android:layout_width="64dp"
android:elevation="20dp"" />
Android API version: Android 9
Material Library version: 1.2.0-alpha06
Device: XiaoMi A1
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Android elevation not showing shadow on Button
The default Button style under Material has a StateListAnimator that controls the android:elevation and android:translationZ properties.
Read more >My journey using Android Material Design Button - Medium
From my observation, the Android Material Button (the one with Elevation and Shadow) are seldom use. The buttons are normally flat, makes me...
Read more >Elevation - Material Design
All elements have default values for resting elevation and dynamic elevation offsets. Certain components are positioned at higher elevations than others, ...
Read more >MaterialButton - Android Developers
A convenience class for creating a new Material button. This class supplies updated Material styles for the button in the constructor.
Read more >material_button.dart - Google Git
To create a custom Material button consider using [TextButton], ... Defaults to 2, the appropriate elevation for raised buttons. The value. /// is...
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
@jaychang0917 it looks like you have to null out the button’s default state list animator:
android:stateListAnimator="@null"
See this similar stack overflow post:
https://stackoverflow.com/questions/38278179/android-elevation-not-showing-shadow-on-button/38278308
I am 100% sure this will fuck up some other functionality