Forum Xamarin.Forms

Xamarin.Forms NavigationPage BackgroundImage - Android

Hi there!
I am trying to setup an image as a background for a NavigationPage on a Xamarin.Forms project.
Here is how my App.cs file looks like:

public class App
        public static Page GetMainPage ()
            var navigation = new NavigationPage(new StartPage());
            navigation.BackgroundImage = "navbg.png";
            return navigation;

On the Android project I have the image in the following path:


However, the image never shows up as a background for the NavigationPage no matter what I try.

Any help will be much appreciated!



  • JacquesBersierJacquesBersier CHMember ✭✭

    I'm facing the same issue. The same code works perfectly on iOS (although it's necessary to manually set the right image for iPhone 5, 6 and 6+). If I can avoid using an absolute layout for something that works fine on iOS, it would be great. Maybe with a page renderer. Any help would be great.

  • JacquesBersierJacquesBersier CHMember ✭✭

    Found the problem. I was using the biggest image I was using for iOS as hdpi drawable. The size of the image was 1242x2208 pixels. So it should be fine. But in the log, I noticed the message "Bitmap too large to be uploaded into a texture 2484x4416". Exactly the double of the original size. I don't know why this happens. But Android seems to double the size of the image. By using a smaller image as background, it worked immediately.

Sign In or Register to comment.