Commit 1f0bc7d
[Android] Implemented material3 support for Button (#33173)
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->
## Description of Change
This pull request adds support for Material 3 styling for the Button
control on Android in .NET MAUI. It introduces runtime feature toggling
for Material 3, configures the necessary Android resources and theming
infrastructure, and applies Material 3 styling to Button controls.
### Material 3 Button support and theming:
- **Added `MauiMaterialButton` style**, which extends
`Widget.Material3.Button` and applies Material 3 design to MAUI buttons.
This style removes Android Material 3 default constraints (minWidth,
minHeight, padding, insets) to allow full MAUI control over button
sizing and layout, and sets `iconSize` to 0dp for proper icon
sizing.[[1]](diffhunk://#diff-ad5ac218072f5fc910079c411a1cb0a014f67083b7bcbbfd3e8fd041f4a1588eR39-R55)
- **Integrated `MauiMaterialButton` into Material 3 base theme** by
setting `materialButtonStyle` attribute to reference the custom button
style, ensuring all buttons automatically receive Material 3 styling
when the feature is enabled.
[[1]](diffhunk://#diff-ad5ac218072f5fc910079c411a1cb0a014f67083b7bcbbfd3e8fd041f4a1588eR8)
Fixes #33172
### Screenshots
Material Design Spec -
[Button](https://m3.material.io/components/buttons/specs)
| Material 2 | Material 3 |
|---------|--------|
| <img height=600 width=300
src="https://github.com/user-attachments/assets/dd767cb0-2672-4514-bdb6-7b2cb8582e14">
| <img height=600 width=300
src="https://github.com/user-attachments/assets/92e69117-fc8b-4942-898b-aa129bead4dc">
|1 parent f118ecc commit 1f0bc7d
File tree
23 files changed
+411
-3
lines changed- src
- Controls/tests
- TestCases.Android.Tests/snapshots/android-notch-36
- Core/src/Platform/Android
- Resources/values
23 files changed
+411
-3
lines changed
0 commit comments