2017-08-02 87 views
1

背景圖像顯示在我的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。除非這是錯的?我究竟做錯了什麼?

回答

2

不要在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

相關問題