【发布时间】:2016-10-27 20:35:12
【问题描述】:
我目前正在 Xamarin.Forms UWP 中创建示例系统。我想知道为什么我的调用图像的代码在 UWP 部分中似乎无法在 Android 中正常工作。我还想将图像设置为背景,将图像设置为按钮。
我如何编写代码以使其在两个平台上都能正常运行?
这是我使用的代码:
<?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="XamarinFormsDemo.Views.LoginPage"
BackgroundImage="bg3.jpg"
Title="MainPage">
<Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
<StackLayout VerticalOptions="Center"
Padding="40">
<Image Source="ebmslogo1.png"/>
<StackLayout Padding="0,50,0,0">
<Entry x:Name="txtUserName"
Placeholder="Username"
x:Hint="Username"
BackgroundColor="Black"
TextColor="White"/>
<Entry x:Name="txtPassword"
Placeholder="Password"
IsPassword="true"
BackgroundColor="Black"
TextColor="White"/>
<Button Text="LOG IN"
FontSize="14"
BackgroundColor="Teal"
Clicked="NavigateButton_OnClicked"/>
</StackLayout>
</StackLayout>
</ContentPage>
我的图片位于 .Droid > Resources > drawable
【问题讨论】:
标签: xaml xamarin xamarin.forms uwp uwp-xaml