xamarin.IOS中的背景图像比例过大
我已经使用xamarin.forms创建了一个应用程序。我刚开始测试iOS端,登录屏幕上的背景图像看起来放大了。在android上,图像显示正确。是否有任何需要更改的内容才能正确显示 Mainpage.xamlxamarin.IOS中的背景图像比例过大,xamarin,xamarin.ios,xamarin.forms,Xamarin,Xamarin.ios,Xamarin.forms,我已经使用xamarin.forms创建了一个应用程序。我刚开始测试iOS端,登录屏幕上的背景图像看起来放大了。在android上,图像显示正确。是否有任何需要更改的内容才能正确显示 Mainpage.xaml <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LoyaltyWorx.MainPage"
BackgroundImage="bk3.jpg"
>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Horizontal" VerticalOptions="Start">
<!-- top controls -->
</StackLayout>
<StackLayout VerticalOptions="CenterAndExpand">
<!-- middle controls -->
<BoxView HeightRequest="430"></BoxView>
<Button Text="Continue with Facebook" x:Name="LoginBtn" BackgroundColor="#4867aa" TextColor="White" FontFamily="Klavika" HorizontalOptions="CenterAndExpand" Clicked="LoginBtn_Clicked" />
</StackLayout>
<StackLayout Orientation="Horizontal" VerticalOptions="End" HorizontalOptions="Center">
<!-- bottom controls -->
<Frame OutlineColor="White" HorizontalOptions="StartAndExpand">
<StackLayout Orientation="Horizontal" VerticalOptions="End" HorizontalOptions="Center">
<!-- bottom controls -->
<StackLayout Grid.Row="1" Orientation="Horizontal" Spacing="0">
<Label
Text="Terms and conditions"
FontSize="13"
TextColor="#71757a"
FontAttributes="Bold"
x:Name="LblTerms"/>
<Label
Text=" and"
FontSize="13"
TextColor="#71757a"
/>
<Label
Text=" privacy policy"
FontSize="13"
TextColor="#71757a"
FontAttributes="Bold"
x:Name="LblPrivacy"/>
</StackLayout>
</StackLayout>
</Frame>
</StackLayout>
</StackLayout>
</ContentPage>
iOS和Android的屏幕截图。
在IOS中,您不能在ContentPage背景图像上播放太多内容,因为它拾取不正确。我将为您提出两种解决方案来摆脱这种情况 两种方法都试一下,得到适合你的 解决方案1
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LoyaltyWorx.MainPage" >
<RelativeLayout>
<Image Source="bk3.jpg"
RelativeLayout.WidthConstraint=
"{ConstraintExpression Type=RelativeToParent, Property=Width}"
RelativeLayout.HeightConstraint=
"{ConstraintExpression Type=RelativeToParent, Property=Height}"/>
<PUT YOUR REST OF CODE HERE>
</RelativeLayout>
</ContentPage>
解决方案2
<?xml version="1.0" encoding="utf-8" >
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LoyaltyWorx.MainPage"
Padding="0">
<Grid>
<Image Source="bk3.jpg" Aspect="AspectFill" />
<StackLayout>
<PUT YOUR REST OF CODE HERE>
</StackLayout>
</Grid>
</ContentPage>
更新我您最喜欢的套件…在IOS中,您不能在ContentPage背景图像上播放太多内容,因为它拾取不正确。我将为您提出两种解决方案来摆脱这种情况 两种方法都试一下,得到适合你的 解决方案1
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LoyaltyWorx.MainPage" >
<RelativeLayout>
<Image Source="bk3.jpg"
RelativeLayout.WidthConstraint=
"{ConstraintExpression Type=RelativeToParent, Property=Width}"
RelativeLayout.HeightConstraint=
"{ConstraintExpression Type=RelativeToParent, Property=Height}"/>
<PUT YOUR REST OF CODE HERE>
</RelativeLayout>
</ContentPage>
解决方案2
<?xml version="1.0" encoding="utf-8" >
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="LoyaltyWorx.MainPage"
Padding="0">
<Grid>
<Image Source="bk3.jpg" Aspect="AspectFill" />
<StackLayout>
<PUT YOUR REST OF CODE HERE>
</StackLayout>
</Grid>
</ContentPage>
更新我您最喜欢的套房……这是一张背景图片吗?除了facebook的登录按钮和其他底部按钮外,这是一张背景图片。我刚刚添加了Facebook的按钮和itI底部的条款和条件。我不认为你可以在内容页背景图像上玩很多,我建议你使用相对布局和背景图像,如果你需要,我可以在这里发布一些示例代码。啊,我明白了,是的,我很感激示例代码。谢谢,这是一张背景图片吗?除了facebook的登录按钮和其他底部按钮外,这是一张背景图片。我刚刚添加了Facebook的按钮和itI底部的条款和条件。我不认为你可以在内容页背景图像上玩很多,我建议你使用相对布局和背景图像,如果你需要,我可以在这里发布一些示例代码。啊,我明白了,是的,我很感激示例代码。谢谢,Shiwanka,请查收。我在我的gridView上尝试了你的解决方案,也用于背景图像,但没有效果。感谢您的帮助,谢谢Shiwanka,请查收。我在我的gridView上尝试了你的解决方案,也用于背景图像,但没有效果。如果你能帮忙,我将不胜感激,谢谢