Skip to content

Frame Error display on Android devicesΒ #13469

Closed

Description

@ManfredRohleder

Frame issue on Android

image
image

I use a Frame -Control with image to display an avatar. On iOS everything works as expected (Image1). On Android, the dimensions of the frame do not fit (Image2).
The really funny thing is that when using a Border control, the behavior is the other way around. Border works on Android but not on iOS.

<Frame 
                            BorderColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}"
                            CornerRadius="25"
                            HeightRequest="50"
                            WidthRequest="50"
                            IsClippedToBounds="True"
                            HorizontalOptions="Start"
                            VerticalOptions="Start">
                                <Image Source="{Binding UserProfileImage}" VerticalOptions="Center" HorizontalOptions="Center"
                              Aspect="AspectFill"
                              HeightRequest="50"
                              WidthRequest="50">
                                    <Image.GestureRecognizers>
                                        <TapGestureRecognizer Tapped="TapGestureRecognizer_PowerProfile" CommandParameter="{Binding UId}"   NumberOfTapsRequired="1" />
                                    </Image.GestureRecognizers>
                                </Image>
                            </Frame>

Steps to Reproduce

https://github.com/ManfredRohleder/FrameIssueAndroid

Link to public reproduction project repository

...

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

No response

Relevant log output

No response

Activity

  1. added
    t/bug
    on Feb 21, 2023
  2. ghost added
    legacy-area-controls
    on Feb 21, 2023
  3. mr5z commented on Feb 21, 2023

    @mr5z

    Just noticed you specify the size in both controls. I think the most common way is to specify it on the Image control only. Let me know how it goes.

  4. Visual-IT-2021 commented on Feb 21, 2023

    @Visual-IT-2021

    @mr5z
    Without the size specification in the frame the behavior in the Android platform is even worse. The frame is even larger.

  5. mr5z commented on Feb 22, 2023

    @mr5z

    @Visual-IT-2021 that shouldn't be the case. I think they should address that issue too.

  6. added
    s/needs-repro
    on Feb 22, 2023
  7. omegazero2310 commented on Feb 23, 2023

    @omegazero2310

    You can workaround by using this NuGet package : PureWeen.Maui.FixesAndWorkarounds
    and call builder.ConfigureMauiWorkarounds(); in MauiProgram.cs
    Because the fix is not backported to .Net 7 yet (currently the fix is on .Net 8 Preview 1)

  8. ghost added
    s/needs-attention
    on Feb 23, 2023
  9. ghost removed
    s/needs-repro
    on Feb 23, 2023
  10. ManfredRohleder commented on Feb 23, 2023

    @ManfredRohleder
    Author

    Found a fix for this.
    if you wrap a VerticalStacklayout with WidthRequest and HeightRequest (same as the image) around the Frame it works.

    To reproduce this, open a new maui project, add a image and paste the code into mainpage.

    <?xml version="1.0" encoding="utf-8" ?>
    <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 x:Class="MauiApp1.MainPage">
    
        <VerticalStackLayout Margin="20,20,20,20">
            <VerticalStackLayout Margin="0,0,0,20">
    
                <Frame
                                BorderColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}"
                                CornerRadius="25"
                                HeightRequest="50"
                                WidthRequest="50"
                                IsClippedToBounds="True"
                                HorizontalOptions="Start"
                                VerticalOptions="Start">
                    <Image Source="ooooops.png" VerticalOptions="Center" HorizontalOptions="Center"
                                  Aspect="AspectFill"
                                  HeightRequest="50"
                                  WidthRequest="50">
                        
                    </Image>
                </Frame>
    
            </VerticalStackLayout>
    
            **<VerticalStackLayout WidthRequest="50" HeightRequest="50">**
    
                <Frame
                                BorderColor="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}"
                                CornerRadius="25"
                                HeightRequest="50"
                                WidthRequest="50"
                                IsClippedToBounds="True"
                                HorizontalOptions="Start"
                                VerticalOptions="Start">
                    <Image Source="ooooops.png" VerticalOptions="Center" HorizontalOptions="Center"
                                  Aspect="AspectFill"
                                  HeightRequest="50"
                                  WidthRequest="50">
    
                    </Image>
                </Frame>
    
            **</VerticalStackLayout>**
        </VerticalStackLayout>
    
    
    </ContentPage>

    image

  11. ManfredRohleder commented on Feb 23, 2023

    @ManfredRohleder
    Author
  12. sesitosvdx commented on Feb 23, 2023

    @sesitosvdx

    In your case where you want to surround an Image with a border I would suggest you use a Border (MAUI exclusive) with StrokeShape="Ellipse" instead of Frame (migrated to ease transition from XF).

    I had many Frames like these on my XF app and after migration to MAUI they were all causing problems (which increased after last release). So finally decided to stop using Frame and changed them all for Border (which is a more versatile and powerfull component) and it solved my problems.

  13. 5 remaining items

  14. added
    partner/cat 😻
    on Feb 27, 2023
  15. added
    p/1
    on Feb 27, 2023
  16. PureWeen commented on Mar 20, 2023

    @PureWeen
    Member

    I tested this sample on the latest branch and it looks like it's fixed on Android

    image

    It's broken on windows still, but I'll open a new issue for windows.

  17. PureWeen commented on Mar 20, 2023

    @PureWeen
    Member

    @Visual-IT-2021 I tested the sample here with Border, and for me, it works the same on all three platforms. If you're having an issue with Border still, can you log an issue?

  18. ghost locked as resolved and limited conversation to collaborators on Apr 19, 2023
  19. modified the milestones: Backlog, .NET 8 on May 22, 2023
  20. added
    fixed-in-8.0.0-preview.1.7762
    fixed-in-7.0.81
    on Jun 8, 2023
  21. removed
    legacy-area-controls
    on May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-framefixed-in-7.0.100fixed-in-7.0.101fixed-in-7.0.81fixed-in-8.0.0-preview.1.7762p/1partner/cat 😻platform/androidt/bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions