-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Android] ImageButton CornerRadius not being applied - fix #30074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that the CornerRadius
on ImageButton
controls is correctly applied on Android by updating the material ShapeAppearanceModel
for ShapeableImageView
. It also adds a reproduction sample and a UI test to catch regressions.
- Extend
UpdateMauiRippleDrawableStroke
to adjust theShapeAppearanceModel
when the platform view is aShapeableImageView
- Add a UI test in
TestCases.Shared.Tests
to verify corner radius rendering - Add a sample page in
TestCases.HostApp
demonstrating the issue
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Core/src/Platform/Android/MauiRippleDrawableExtensions.cs | Added ShapeableImageView handling to apply rounded corners |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23854.cs | Added a UI test that waits for the ImageButton and takes a screenshot |
src/Controls/tests/TestCases.HostApp/Issues/Issue23854.cs | Added a sample page with multiple ImageButton configurations |
.SetTopLeftCorner(CornerFamily.Rounded, radius) | ||
.SetTopRightCorner(CornerFamily.Rounded, radius) | ||
.SetBottomLeftCorner(CornerFamily.Rounded, radius) | ||
.SetBottomRightCorner(CornerFamily.Rounded, radius) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] You can reduce repetition by using a single builder method (e.g., SetAllCornerSizes
or an equivalent) to apply the same radius to all corners in one call, which improves readability and maintainability.
.SetTopLeftCorner(CornerFamily.Rounded, radius) | |
.SetTopRightCorner(CornerFamily.Rounded, radius) | |
.SetBottomLeftCorner(CornerFamily.Rounded, radius) | |
.SetBottomRightCorner(CornerFamily.Rounded, radius) | |
.SetAllCorners(CornerFamily.Rounded, radius) |
Copilot uses AI. Check for mistakes.
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
public void CornerRadiusShouldBeApplied() | ||
{ | ||
App.WaitForElement("ImageButton"); | ||
VerifyScreenshot(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
protected override void Init() | ||
{ | ||
Content = new VerticalStackLayout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you include a couple of samples using the BorderWidth
and BorderColor
properties?
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 from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issues Fixed
Fixes #23854