maui icon indicating copy to clipboard operation
maui copied to clipboard

[Android] RefreshView does not layout properly when it is placed inside a Grid

Open rafalka opened this issue 1 year ago • 2 comments

Description

RefreshView does not layout properly on Android when is measured and lay out with different bounds. This happens ie when it is placed inside a Grid with spans (where first grid layout pass cannot determine row height)

Ie this XAML:

    <Grid RowDefinitions="Auto,*,Auto" ColumnDefinitions="Auto,*">
        <Ellipse
            Grid.Row="0" Grid.ColumnSpan="2" WidthRequest="100" HeightRequest="100" BackgroundColor="Green"/>
        <Ellipse
            Grid.Row="1" Grid.Column="0" BackgroundColor="Green"/>
        <RefreshView Grid.Row="1" Grid.Column="1">
            <Ellipse BackgroundColor="Red"/>
        </RefreshView>
        <Ellipse Grid.Row="2" Grid.ColumnSpan="2" WidthRequest="100" HeightRequest="100" BackgroundColor="Green"/>
    </Grid>

Results: iOS: Image Android: Image

As I checked, root cause is fact that Android SwipeRefreshLayout.onLayout() takes measured width/height instead of provided layout dimensions.

Steps to Reproduce

Download sample project and compare behavior on Android and other OSes.

Link to public reproduction project repository

https://github.com/rafalka/MauiRefreshViewIssue

Version with bug

8.0.92 SR9.2

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 9 and up

Did you find any workaround?

Unfortunately I haven't found any good workaround for this issue.

Relevant log output

Logs taken from this sample on Android:

RefreshView: MeasureOverride(W:411, H:786), Result: W:411, H:786
RefreshView: ArrangeOverride(W:409, H:586), Result: W:409, H:586

rafalka avatar Oct 24 '24 07:10 rafalka

We've found some similar issues:

  • #25368 , similarity score: 85%
  • #9008 , similarity score: 82%

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

similar-issues-ai[bot] avatar Oct 24 '24 07:10 similar-issues-ai[bot]

This issue has been verified using Visual Studio 17.12.0 Preview 3( 8.0.92 &8.0.82 & 8.0.3). Can repro this issue on android platform.

Zhanglirong-Winnie avatar Oct 24 '24 08:10 Zhanglirong-Winnie