I want to display the Android application in full screen, but even if I select __ "Empty Activity" __ </ font> in the project initial settings (Activity), Since the notification bar is displayed, this time I would like to describe the settings around this notification bar collectively. (Written by [Mon] on May 15, 2017)
"Empty Activity" `` `selected at the time of initial project setup.
Hmmm, I want to hide __ "① Status bar" __ </ font> and __ "② Title bar" __ </ font>.
As a result of various investigations above, it seems that AndroidManifest.xml should be modified.
AndroidManifest.xml
(Change before) android:theme="@style/AppTheme"
(After change) android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
So, the status bar and title bar should disappear, but.
__ Error details __ </ font> java.lang.IllegalStateException: You need to use a Theme.AppCompat theme with this activity. Since it inherits AppCompat, please write according to it! I was angry, so I checked AppCompat and themes again.
When I looked it up, it seemed that I could easily change it to full screen display, so Make a note of the procedure below.
Project name> app > src > main > res > values > style.xml
__(Before correction)__
#### **`style.xml`**
```xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
(Revised)
style.xml
<resources>
<!-- Base application theme. -->
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!-- add Style -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</resources>
AndroidManifest.xml
android:theme="@style/AppTheme"
↓ (After change)
AndroidManifest.xml
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
I was able to hide both the status bar and the title bar.
Thank you for reading to the end. If you like, please like it.
Recommended Posts