0

I am working on an app in Visual Studio with the appcompat theme. I want to put it into fullscreen mode. This however isn't working since I cannot find the "Styles" section mentioned for instance here:

Full Screen Theme for AppCompat

Does anyone know how to translate that into C#? Or even better, how to put the appcompat into fullscreen? :)

THANKS :)

pinedax
  • 9,246
  • 2
  • 23
  • 30
MrMee
  • 143
  • 1
  • 10

1 Answers1

2

The styles.xml is not created with the default template but you can manually created.

In the Solution go to Resources -> Values and right click over this last one and select Add -> New File.

From the dialog select XML and put the name of styles.xml

enter image description here

Once created pastes this inside

<?xml version="1.0" encoding="UTF-8" ?>
<resources>
    <style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="Theme.AppCompat.Light">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style>
</resources>

We are almost done. Now you just have to tell the app to use this Theme you just created.

If you want the whole App to be full screen you need to set the Theme on the Application Layer. This can be done in the project options -> Android Application, in the Application Theme section paste the name of theme you want to use.

enter image description here

Notice the full name is

@style/Theme.AppCompat.Light.NoActionBar.FullScreen

You are good to go! Your whole app will now run full screen.

Hope this helps.-

pinedax
  • 9,246
  • 2
  • 23
  • 30
  • 2
    One note I'd like to mention is that the file does not need to be named `styles.xml`, it can be any arbitrary name. I have found that it confuses developers because they think the plural file name is how they retrieve a style within their XML. i.e using `@styles` instead of the proper `@style`. – Jon Douglas Jun 15 '17 at 16:51
  • Hello and thank you so much! It worked so perfect :)) 10000 THANKS! – MrMee Jun 16 '17 at 08:52