Reputation: 1632
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:
Visible status bar:
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>
Upvotes: 1
Views: 5115
Reputation: 31
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.
Upvotes: 1
Reputation: 700
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"
Upvotes: 1
Reputation: 41
Use this code inside the style.xml
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
</style>
Upvotes: 3