在iOS上显示背景但在Android上不显示Xamarin

问题描述:

背景图像显示在我的iOS项目中,但未显示在Android中。我对Xamarin相当陌生,所以这可能是一个相当简单的错误。在iOS上显示背景但在Android上不显示Xamarin

<?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="Simple_Project.Views.ItemDetailPage" 
     Title="{Binding Title}" 
     BackgroundImage="Background-1.jpg"> 
    <ScrollView> 
     <StackLayout Spacing="20" Padding="15"> 
      <!--content here--> 
     </StackLayout> 
    </ScrollView> 
</ContentPage> 

我在想BackgroundImage会兼顾iOS和Android。除非这是错的?我究竟做错了什么?

不要在Android资源文件名,使用破折号,下划线做工精细,所以重命名......

Background-1.jpg 

Background_1.jpg 

...在你的代码,并在所有的项目,否则使用OnPlatform

+0

不幸的是,似乎没有解决这个问题。请问OnPlatfrom可能是什么? – user2438817

+0

您可能想要清理并重新构建解决方案... OnPlatform或RuntimePlatform:https://developer.xamarin.com/api/member/Xamarin.Forms.Device.OnPlatform/ – SushiHangover

+0

没有修复它。 OnPlatform会允许我更改特定页面的背景吗? – user2438817