【发布时间】:2018-08-22 08:14:04
【问题描述】:
我在工具栏中显示图标时遇到问题。 在 Android 上,它工作正常,但在 UWP 上,图标是白色的,当你将它悬停时是黑色的。 你知道怎么解决吗?
我的代码:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="VwDemo.LoginPage"
Title="Logowanie">
<ContentPage.ToolbarItems>
<ToolbarItem Icon="VwLogo.png" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<StackLayout VerticalOptions="StartAndExpand" Margin="10,10,10,0">
<Label Text="Login" />
<Entry x:Name="LoginEntry" Placeholder="Login"/>
<Label Text="Hasło" />
<Entry x:Name="PasswordEntry" IsPassword="True" Placeholder="Hasło" />
<Button Text="Zaloguj" Clicked="OnLoginButtonClicked" BackgroundColor="#FF3579B4" TextColor="#FFFBF8F8" />
<Label x:Name="MessageLabel" HorizontalTextAlignment="Center" TextColor="Red" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
【问题讨论】:
-
你需要让UWP知道你的图片的根位置见以下文档docs.microsoft.com/en-us/previous-versions/windows/apps/…
-
@StuartSmith 提供的链接是一些旧的 Windows 8 文档,我建议查看这些 xamarin forms docs,上面写着 Universal Windows Platform (UWP) - Place images in the application's root directory带有构建操作:内容。
-
我在应用程序的根目录中有图像,构建操作设置为内容。 imgur.com/pSaUE05