Skip to content

[Android]Fix for Android ImageButton Border Visibility and Update Test Snapshots for Issue - #39526

Merged
kubaflo merged 3 commits into
dotnet:inflight/currentfrom
BagavathiPerumal:fix-29956
Oct 22, 2026
Merged

kubaflo merged 3 commits into
dotnet:inflight/currentfrom
BagavathiPerumal:fix-29956

Conversation

@BagavathiPerumal

Copy link
Copy Markdown
Contributor

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!

Root cause

The issue occur because of the Android ImageButton rendering its border as part of the view’s background, behind its image. Image scaling can draw the image into the area reserved for the border. With AspectFill, the image may extend beyond the content area, while with Center, a large image can also overlap the border. The image then obscures the background stroke, making some or all sides appear missing. This affects URI and file image sources.

Solution description

The fix involves enabling CropToPadding on the Android ShapeableImageView created by ImageButtonHandler. This setting ensures that image drawing is clipped to the view’s padded content area instead of extending into the area reserved for the border. As a result, the image no longer obscures the background stroke, and the border remains visible on all sides. The setting is applied in the shared handler setup, addressing the issue for both AspectFill and Center image rendering without changing the existing image scaling modes.

Snapshot Updates:

I have replaced the existing snapshots with updated versions to reflect the expected visual changes introduced by enabling CropToPadding. This clips image drawing to the padded content area, preventing the image from overlapping the border and ensuring the border remains visible.

  • VerifyImageButtonAspect_AspectFillWithImageSourceFromFontImage
  • VerifyMaterial3ImageButtonAspect_AspectFillWithImageSourceFromFontImage

Additional Test Snapshots and Restriction Removal

I have added the required snapshots and removed the test restrictions for the following test cases related to issue #29956.

ImageButton test cases:

  • VerifyImageButtonAspect_AspectFillWithImageSourceFromUri
  • VerifyImageButtonAspect_AspectFillWithImageSourceFromFile
  • VerifyImageButtonAspect_CenterWithImageSourceFromUri

Material 3 ImageButton test cases:

  • VerifyMaterial3ImageButtonAspect_AspectFillWithImageSourceFromUri
  • VerifyMaterial3ImageButtonAspect_AspectFillWithImageSourceFromFile
  • VerifyMaterial3ImageButtonAspect_CenterWithImageSourceFromUri

Validated the behavior in the following platforms

  • Android
  • Mac
  • iOS
  • Windows

Issues Fixed

Fixes #29956

Output ScreenShot

Platform Before After
Android
29956-BeforeFix.mov
29956-AfterFix.mov

kubaflo and others added 2 commits October 21, 2026 14:15
<!-- 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

<!-- Enter description of the fix in this section -->

Remove the unused SDK insertion templates instead of migrating their
retired `VSEngSS-MicroBuild2022-1ES` pool:

- `eng/pipelines/common/insertion.yml`
- `eng/pipelines/common/sdk-insertion.yml`

The stage template has no callers, and the job template is referenced
only by that stage. The former `maui-release.yml` caller was removed in
dotnet#31130. The current official build uses Arcade publishing; its
configured YAML entry point and matching `main` revision were checked in
Azure DevOps. The legacy DevDiv MAUI pipeline definitions are disabled.
No active pipeline, publishing stage, or pool is changed.

**Validation:** `git diff --check` passed. PyYAML parsed all 39
remaining pipeline YAML files, and all 113 static local template
references resolved. A tracked-file search found no remaining references
to the retired pool, either deleted template, or the old `sdk_insertion`
stage. No new pipeline tests were added, and no device/UI tests were run
for this configuration-only deletion.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes dotnet#39518

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2f892844-9872-4d2f-8799-c45663efc2a3
…utton to prevent images from overlapping the border, update the test snapshots, and remove the testcase restrictions.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39526

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39526"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@azure-pipelines

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

3 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

2 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

@github-actions

Copy link
Copy Markdown
Contributor

/review gate was not started: another review or Gate is already running for this PR.

This command is not queued. Submit it again after the current run finishes.

This was referenced Nov 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-button Button, ImageButton community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android s/agent-review-in-progress AI review is currently running for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] ImageButton Border Not Rendering Correctly with URI and File Images when applying Aspect property

5 participants