【发布时间】:2020-03-29 12:06:23
【问题描述】:
我在使用 Xamarin.Forms 中的 CornerRadius 时遇到了一些问题。我想要一个具有 CornerRadius=100 的 ImageButton 和一个 Frame(其中包含一个图像)。 这在 Android 上运行良好,但在 iOS 上运行时无法按预期运行: Frame 不再是一个圆圈,并且 ImageButton 消失了。
Picture of iOS and Android Emulator
我的代码:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="FrameTest.MainPage">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ImageButton Grid.Row="0"
Grid.Column="0"
BackgroundColor="#fc85ae"
CornerRadius="100"
Padding="2"
Source="settings_wheel.png"
HeightRequest="40"
WidthRequest="40"
HorizontalOptions="End"/>
<Frame Grid.Row="1"
Grid.Column="0"
BorderColor="Black"
CornerRadius="100"
HeightRequest="100"
WidthRequest="100"
IsClippedToBounds="True"
HorizontalOptions="Center"
VerticalOptions="Center">
<Image x:Name="ProfilePictureView"
BackgroundColor="#fc85ae" />
</Frame>
</Grid>
Xamarin.Essentials:1.3.1 Xamarin.Forms:4.3.0.908675
【问题讨论】:
标签: c# xaml xamarin xamarin.forms