How to draw into display cutout area?

Apparently in Android 9.0 (API 28) setting
Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
in OnCreate() allows the application to use display cutout area. Can someone post an example? I see only white area that I don’t know how to draw to.

I have figured it out myself at last. For those interested this is how you extend your screen into the cutout area:
Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges; Window.AddFlags(WindowManagerFlags.TranslucentStatus);
All the samples out there mention the 1st line, but you need both lines for this to work.

Having said that I tried to upgrade Xamarin.Android.Support.v4 to v28.0.0-preview1in order to test the DisplayCutout class, but the code won’t even compile. The error I get is

./pietest3/packages/Xamarin.Android.Support.Annotations.28.0.0-preview1/build/monoandroid90/Xamarin.Android.Support.Annotations.targets(5,5): Error MSB4066: The attribute "xmlns" in element <UsingTask> is unrecognized. (MSB4066) (pietest3.Android)

Seems like I got stuck again. If I try to edit the file I get a different error yet:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1010,3): error : You have Jar libraries, common.jar, that have the identical name with inconsistent file contents. Please make sure to remove any conflicting libraries in EmbeddedJar, InputJar and AndroidJavaLibrary.

1 Like