[MaterialButton] Change button insets programmatically especially since they don't default to 0dp
See original GitHub issueIs your feature request related to a problem? Please describe. This might be more of question than a request, but I’m not sure why we would want inset at the top and bottom by default. I understand that the property could be of use, but I end up removing the inset by default in all my apps through a style like so:
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
- Could you provide more info for having inset having a value greater than
0dp
by default? - Is the inset related to elevation and shadow?
Describe the solution you’d like
Set the default inset of buttons to 0dp
.
Describe alternatives you’ve considered
As an alternative, and if the inset is related to the shadow from the elevation, maybe the UNELEVATED
style could reset the inset to 0dp?.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:13 (5 by maintainers)
Top Results From Across the Web
How to remove padding around buttons in Android?
For removing padding around toggle button we need set minWidth and minHeight 0dp. android:minWidth="0dp" android:minHeight="0dp"
Read more >Hands-on with Material Components for Android: Buttons
Material Buttons are slightly different to traditional Android buttons in that they do not include additional insets (4dp on the left/right) ...
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 >COP4656 Midterm - Test Flashcards - Quizlet
The Android emulator is particularly useful if you do not have access to Android devices for testing. b. Although you can simulate orientation...
Read more >Building a Material Theme on Android: Shape
Material button transforming from baseline style to show off ... theming gives you the ability to define global shape values that change the ......
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
Has there been any progress on this?
The insets exist as part of ensuring the touch targets are large enough for mobility impaired users with the default style, so we’re unlikely to change them. We recommend at least 48dp as a minimum touch target.
That said, it seems completely reasonable to want to change them programmaticly, so I’ll update the issue to reflect that.