1

I've made my app fullscreen with no title by writing following code

<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>

But I can open action bar and notifications bar as we usually do from top. Is there any way to never show top action bar.

Fullscreen App:

enter image description here

Visible status bar:

enter image description here

As soon as I touch and slide down from top mobile status bar becomes visible. How to stop that ?

Updates:

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sampleapp">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTask"
            android:stateNotNeeded="true"
            android:theme="@style/AppTheme.Wallpaper">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name=".LockScreenActivity" />
    </application>
</manifest>

styles.xml

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <!-- THIS IS THE MAIN THEME -->
    <style name="AppTheme.Wallpaper" parent="@style/Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowShowWallpaper">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style>
</resources>
Zain SMJ
  • 1,492
  • 7
  • 19
  • 33
  • 1
    Possible duplicate of [Hide or remove Action Bar on specific Activity | Android](https://stackoverflow.com/questions/41511214/hide-or-remove-action-bar-on-specific-activity-android) – grrigore Aug 31 '18 at 14:37
  • Possible duplicate of [Hide Notification bar](https://stackoverflow.com/questions/4222713/hide-notification-bar) – ivan Aug 31 '18 at 15:49
  • No. Not a duplicate. I've updated my question with some screenshots to be more specific. TIA – Zain SMJ Sep 03 '18 at 07:24

3 Answers3

3

Use this code inside the style.xml

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
</style>
Diego Mello
  • 5,220
  • 3
  • 17
  • 21
1

First, make these changes in the themes.xml file as shown below and then, in AndroidManifest.xml file add "android:theme="@style/FullScreen" this line in activity section.

<resources xmlns:tools="http://schemas.android.com/tools">
                
<style name="Theme._your_app_name" parent="Theme.MaterialComponents.DayNight.NoActionBar">
                    
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
        
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
                           
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
                    
</style>

<style name="FullScreen" parent="Theme._your_app_name">
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>

</style>
</resources>
    

Don't forget to add "android:theme="@style/FullScreen" line in AndroidManifest.xml file under activity section.

0

Try this!

   @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            this.requestWindowFeature(Window.FEATURE_NO_TITLE);
            this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.activity_main);
    }

in style.xml:

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
</style>

in manifest application tag:

android:theme="@style/AppTheme"
Tara
  • 692
  • 5
  • 23