728x90
728x170

Image 를 원형으로 잘라 보이게 하고 싶을때는

Frame 로 감싸서 만들면 된다.


아래는 xaml 단 코드 예시이다.

<Frame 

    Margin="0" 

    Padding="0" 

    CornerRadius="30" 

    WidthRequest="60" 

    HeightRequest="60" 

    BackgroundColor="Transparent" 

    HasShadow="False" 

    IsClippedToBounds="True">

    <Image x:Name="simpleOrder2Image" Source="coffee.png"/>

</Frame>


여기서 유의할건 Frame 에 IsClippedToBounds="True" 를 반드시 설정해야한다는것이고

Xamarin.Forms 4.8.0 이어야 iOS 에서도 정상적으로 잘려서 보이게된다.

4.7.0 이하 버전에서는 iOS 에서 이미지가 잘려서 원형으로 나타나지 않는다. 


이는 버그로 수정되어 업데이트 된지 얼마되지 않었다.

https://github.com/xamarin/Xamarin.Forms/pull/11129



728x90
그리드형
Posted by kjun
,