Xamarin Forms Frame.IsClippedToBounds not working on Android

4.2k views Asked by At

I've working on some page in my app and I just find out Frame.IsClippedToBounds property is not clipping its content. Here is a piece of code in my XAML:

<Frame Padding="0" HeightRequest="100" WidthRequest="100" HasShadow="False" BackgroundColor="White"
    CornerRadius="50" BorderColor="Teal" HorizontalOptions="Center" VerticalOptions="Center"
    IsClippedToBounds="True">
    <Frame.Content>
        <StackLayout BackgroundColor="Silver" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"/>
    </Frame.Content>
</Frame>

It works perfectly in iOS but not in Android as you can see in the attachments bellow.

iOS

iOS Sample

Android

Android Sample

2

There are 2 answers

2
Wendy Zang - MSFT On

This quetion has be reported on GitHub and be fixed. https://github.com/xamarin/Xamarin.Forms/pull/6358

You could update your Xamarin.forms version to latest.

I test on Xamarin.forms 4.3.0.908675. It works well.

enter image description here

0
cPlusPlus_Lemons On

Your attribute HeightRequest is giving you the issue; remove this property and IsClippedToBounds will work