[ANDROID] ScrollView not increasing in height when its child ListView or CollectionView are getting more items
See original GitHub issueDescription
At first it looked like scrolling isn’t working any more, then I realised lager pages are scrolling fine, made some testing and realised height of ScrollView on Android is always the same as when the page is rendered first time. If you add more items into ListView or CollectionView they will push elements bellow them into invisibility. Going to next page and returning back did not help.
Steps to Reproduce
Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.2.0 Preview 6.0 create MauiCollectionViewTestV172P6 project MauiCollectionViewTestV172P6-scrollviewnotincreasingheightonandroid.zip
There are both CollectionView and ListView in XAML, uncomment the one you want to use. Buttons are added to make the page bigger than one screen to make it scrollable on first rendering.
In c# you can uncomment code to add 30 objects to either list or ObservableCollection
also different possibilites of populating the view are possible - just uncomment the one you want.
await DisplayAlert(“ScrollViewSize”, ScrollView1.ContentSize.ToString(), “OK”); will display message with size of the scrollview after eack click. On WINDOWS he height option changes when new objects are displayed, on Android it always stays the same number.
ALSO it won’t decrease in size either try: add 30 objects by uncommenting code after InitializeComponent()
Change NextPage Button so it will delete all collection elements
private async void ClickedButtonNextPage(object sender, EventArgs e)
{
while (collection.Count > 0)
{
collection.RemoveAt(0);
}
}
On WINDOWS size will decrease but on ANDROID ScrollView height will remain large and there will be a large white area after the last element at the end of the page when you scroll down.
Version with bug
Release Candidate 2 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Tested on Android 5 and 9
Did you find any workaround?
No response
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
I’m having the same issue when manually updating the contents of the Scrollview in any way that changes their size.
There are a few issues that seem to be addressing the same issue, such as #7374
EDIT: As a follow-up, manipulating content sizes inside scrollviews does not cause issues in windows as far as I have found
Verified this is fixed in our current codebase. Should be released as part of the next service release. Thanks everyone for the help and input here!