Search code examples
androidandroid-studioandroid-tvleanback

Android Studio Leanback Hiding Status Bar


I'm working on an Android TV app. By default it uses the Leanback theme. When the app runs on a device there is no status bar, obviously because it's a TV. However when designing the .xml's in Android Studio on the Render Screen the status bar is shown which makes it hard to work out positioning.

Is there a way to hide the status bar in the Render screen in Android Studio while using Leanback theme.


Solution

  • You can add android:windowFullscreen to your theme, for example:

    <style name="Theme.Example.Leanback" parent="Theme.Leanback">
        <item name="android:windowEnterTransition">@android:transition/fade</item>
        <item name="android:windowExitTransition">@android:transition/fade</item>
        <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
        <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
        <item name="android:windowAllowReturnTransitionOverlap">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">true</item>
        <item name="android:windowContentTransitions">true</item>
        <item name="android:colorPrimary">@color/search_opaque</item>
        <item name="android:windowFullscreen">true</item>
    </style>
    

    and then select Example.Leanback from the theme selector.