【发布时间】:2019-05-21 04:51:51
【问题描述】:
我正在尝试使用 Xaml 将背景图像合并到我的应用程序中。我尝试了各种不同的方法,但似乎都没有奏效。我现在的代码是
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Cabiee;assembly=Cabiee"
BackgroundImage="CabieBackground.jpg"
x:Class="Cabiee.Login">
<ContentPage.Content>
<StackLayout VerticalOptions="CenterAndExpand" HeightRequest="500">
<Entry
x:Name="usernameEntry"
Placeholder="Email"/>
<Entry
x:Name="passwordEntry"
IsPassword="true"
Placeholder="*********"
Completed="PasswordEntry_Completed"/>
<StackLayout Orientation="Horizontal">
<Button
x:Name="BtnCustomer"
Text="Customer"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
FontSize="30"
Clicked="BtnCustomer_Clicked"/>
<Button
x:Name="BtnDriver"
Text="Driver"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
FontSize="30"
Clicked="BtnDriver_Clicked"/>
</StackLayout>
<RelativeLayout HorizontalOptions="CenterAndExpand" >
<Button
x:Name="BtnRegister"
WidthRequest="300"
Text="Register"
FontSize="30"
Clicked="BtnRegister_Clicked"
/>
</RelativeLayout>
</StackLayout>
</ContentPage.Content>
这就是我的解决方案资源管理器的样子:https://gyazo.com/0af186bbca7e8456dfb1e7b1bafcb7ad
我的 Resources 文件夹中有 CabieBackground.jpg,所以它会显示在 android 上,但是当我运行代码时,屏幕上什么也没有出现,它只是空白
背景图片是用photoshop制作的,尺寸为:640px x 1136 px,分辨率为600像素/英寸
【问题讨论】:
标签: xaml xamarin.forms