Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Setting global background with Xamarin Forms

$
0
0

So, while I was having some major issues with backgrounds on this project, I thought about doing what I usually do in Windows Phone, and set a global background in the root frame that doesn't bother with the NavigationBars and Toolbar menus.

I went in the native projects, and since I have a WP background, setting it was very straight forward and worked perfectly.

Android on the other hand, is doing my head in. (haven't even pulled out the mac to try iOS yet...)
I've tried:

SetContentView(Resource.Layout.Main);

that stays on top of the Forms page, so doesn't work.

this.SetTheme(Resource.Drawable.CustomBackground);
this.Application.SetTheme(Resource.Drawable.CustomBackground);

with a theme in the resources having

item name="android:background">@drawable/appbackground

and it just keeps the default format.

I also tried

this.Window.SetBackgroundDrawableResource(Resource.Drawable.AppBackground);

but that only works on the first page, when I navigate to another page (using PushModal untill I reach the authenticated area of the app) it reverts back to the default background.

I feel like I'm trying every wrong approach here, what is the best way to do it really? And what about on iOS?


Viewing all articles
Browse latest Browse all 58056

Trending Articles