What is the simplest change that I can make to a new Blank Activity, as created by the latest version of Android Studio, to get the app to appear fullscreen?
I want
you can do make App in FullScreen Mode form just one line code. i am using this in my code.
just set AppTheme -> Theme.AppCompat.Light.NoActionBar in your style.xml
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
It will work in all pages..
Just add the following attribute to your current theme:
<item name="android:windowFullscreen">true</item>
For example:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/orange</item>
<item name="colorPrimaryDark">@android:color/holo_orange_dark</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
just do this in your manifest file in your activity tag
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
Simply declare in styles.xml
<style name="AppTheme.Fullscreen" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
Then use in menifest.xml
<activity
android:name=".activities.Splash"
android:theme="@style/AppTheme.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Chill Pill :)
I recently had the exact same issue and benefitted from the following post as well (in addition to Rohit5k2's solution above):
https://bsgconsultancy.wordpress.com/2015/09/13/convert-any-website-into-android-application-by-using-android-studio/
In Step 3, MainActivity
extends Activity
instead of ActionBarActivity
(as Rohit5k2 mentioned). Putting the NoTitleBar
and Fullscreen
theme elements into the correct places in the AndroidManifest.xml
file is also very important (take a look at Step 4).
In onCreate
call
requestWindowFeature(Window.FEATURE_NO_TITLE); // for hiding title
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);