[Android] Fixed the ScrollbarVisibility issues#27613
Merged
mattleibow merged 3 commits intodotnet:mainfrom Feb 28, 2025
Merged
Conversation
Contributor
|
Hey there @Ahamed-Ali! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
src/Core/src/Platform/Android/MauiScrollView.cs:72
- [nitpick] The variable name
_verticalScrollVisibilityshould not be prefixed with an underscore as it is not a private field. Consider renaming it toverticalScrollVisibility.
ScrollBarVisibility _verticalScrollVisibility = scrollBarVisibility;
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
mattleibow
reviewed
Feb 27, 2025
mattleibow
requested changes
Feb 27, 2025
Member
mattleibow
left a comment
There was a problem hiding this comment.
Need to pick a side, so changes requested it is.
The code is good, but I worry about that removed method and the crash comment.
mattleibow
approved these changes
Feb 28, 2025
tj-devel709
pushed a commit
that referenced
this pull request
Mar 3, 2025
* [Android] Fixed the ScrollbarVisibility issues * Committed the review changes and added additional test * Renamed Variable
bhavanesh2001
pushed a commit
to bhavanesh2001/maui
that referenced
this pull request
Mar 7, 2025
* [Android] Fixed the ScrollbarVisibility issues * Committed the review changes and added additional test * Renamed Variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause of the issue
Initial Case:
ScrollBarFadingEnabledproperty is always set to true even whenScrollBarVisibilityis set toAlways. As a result, the scrollbar remains hidden in the Always visibility mode.Dynamic Case:
After fixing the initial issue, it was observed that when the visibility mode changes dynamically from
DefaulttoAlways, the scrollbar does not display correctly. AlthoughScrollBarFadingEnabledis updated properly, the scrollbar remains hidden because the HandleScrollBarVisibilityChange method processes both its true and false states, and RequestLayout is not called.In the native Android itself, dynamic changes to
ScrollbarFadingEnabledare not properly reflected in the UI until the view is scrolled. CallingRequestLayoutwhen dynamic changes occur ensures that the native UI updates correctly.Description of Change
Initial Case:
ScrollBarFadingEnabledbased on ScrollBarVisibility resolves the issue.Dynamic Case:
RequestLayoutIfNeededefficiently resolves the dynamic issues and ensures that the UI updates properly. With RequestLayoutIfNeeded, calling AwakenScrollBars may no longer be necessary.Issues Fixed
Fixes #24894
Fixes #12760
Tested the behaviour in the following platforms
Screenshot
VerticalScrollbarVisibility
VerticalScrollBarIssue.mov
VerticalScrollbarFix.mov
HorizontalScrollbarVisibility
HorizontalScrollbarIssue.mov
HorizontalScrollbarFix.mov