Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Fullscreen custom renderer for Android

$
0
0

I want some content pages to have a transparent background on the navigation bar (toolbar on Android). Since I only need this for a few pages in the app I created a custom renderer: FullscreenPageRenderer.

public class FullscreenPageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
Activity parent = (Activity)Context;
var toolbar = parent.FindViewById(Resource.Id.toolbar);
toolbar.Background = new ColorDrawable(Color.Transparent.ToAndroid());
parent.Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
parent.Window.AddFlags(WindowManagerFlags.Fullscreen);
ViewGroup.ForceLayout();
}
}

I want it to look like this image

After setting this properties in my renderer I still get a behavior where my page content is placed beneath the toolbar and not underneath it.
Any suggestions to this is greatly appreciated.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>