How to use WindowManagerPreference:FreeformWindowSize and WindowManagerPreference:FreeformWindowOrientation

Viewed 356

I'm puzzled about how to use WindowManagerPreference:FreeformWindowSize and WindowManagerPreference:FreeformWindowOrientation mentioned in the official Android on ChromeOS guide.

When I use it, it seems like the window is always maximized, e.g. if I set it up like this:

<meta-data android:name="WindowManagerPreference:FreeformWindowSize"
        android:value="phone" />
<meta-data android:name="WindowManagerPreference:FreeformWindowOrientation"
        android:value="portrait" />

If I at the same time specify layout for an activity and starts it directly, the window is not maximized anymore.

Does anyone know how the two meta tags can be used? When I google them, the only results is the guide mentioned above and a few other projects using them.

2 Answers

I am seeing the same. Adding these parameters seems to have no effect on Chrome OS.

Answer for a Xamarin context, and with a different meta data option. (Although technique should work for all development environments)

Note the metadata needs to be under the Activity element in the AndroidManifest.xml

Using C#/Xamarin one can add the MetaDataAttribute to main Activity.

[MetaData("WindowManagerPreference:SuppressWindowControlNavigationButton", Value = "true")]

[Activity(Label =...
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity

This removes the backbutton from android apps running on chromeos, but has no effect on android apps running on android devices.

Related