-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix [Android] Image AspectFill is not honored #25072
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@@ -17,6 +17,11 @@ public static void Clear(this ImageView imageView) | |||
|
|||
public static void UpdateAspect(this ImageView imageView, IImage image) | |||
{ | |||
if (image.Aspect is Aspect.AspectFill) |
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.
If I delete this code the test still passes
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.
A new test has been added, and now the test only passes when the fix is applied. This ensures that the fix is correctly addressing the issue, and without it, the test fails as expected.
f7cc1b7
to
51e1baa
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
if (image.Aspect is Aspect.AspectFill) | ||
imageView.SetAdjustViewBounds(false); | ||
else | ||
imageView.SetAdjustViewBounds(true); |
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.
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.
I’ve modified the fix and rerun the mentioned test. The test passed successfully without any issues.
Also I have committed the same. Could you please check and let me know.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
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.
Copilot reviewed 6 out of 7 changed files in this pull request and generated no suggestions.
Files not reviewed (1)
- src/Controls/tests/TestCases.HostApp/Issues/Issue21368.xaml: Language not supported
Comments skipped due to low confidence (2)
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21368.cs:30
- Remove the extra space before the
#endif
directive.
#endif
src/Core/src/Platform/Android/ImageViewExtensions.cs:19
- The new behavior in the UpdateAspect method should have explicit test coverage to ensure the aspect handling logic is verified.
public static void UpdateAspect(this ImageView imageView, IImage image)
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
|
Root Cause
In Image Android Handler, set true for SetAdjustViewBounds(), when you enable view bounds adjustment, the ImageView will automatically resize to maintain the image's aspect ratio.
Description of Change
This update fixes image aspect handling for Android in ImageView, If the aspect is AspectFill, set the false for SetAdjustViewBounds(), so the view bounds are not adjusted, allowing the image to fill the view.
Tested the behaviour in the following platforms
Issues Fixed
Fixes #21368
Output Screenshot