Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fullscreen Activity in Android?

How do I make an activity full screen? Without the notification bar.

like image 526
Praveen Avatar asked May 19 '10 17:05

Praveen


People also ask

How do I make Android activity full screen?

This example demonstrate about How to get full screen activity in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.

What is fullscreen on Android?

Full screen mode allows you to watch videos that take up your entire screen.

How do I set fullscreen activity?

See the steps: Right click on your java main package > Select “New” > Select “Activity” > Then, click on “Fullscreen Activity”.

How do I get full screen on my phone?

If you're using an app and want to toggle full screen on or off, you can do it from the recent apps list: Drag up from the bottom of the home screen, hold, then release. Or, touch if you're using 3-button navigation.


3 Answers

You can do it programatically:

public class ActivityName extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove title
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
    }
}

Or you can do it via your AndroidManifest.xml file:

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

Edit:

If you are using AppCompatActivity then you need to add new theme

<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

and then use it.

<activity android:name=".ActivityName"
    android:label="@string/app_name"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/>

Thanks to https://stackoverflow.com/a/25365193/1646479

like image 188
Cristian Avatar answered Oct 14 '22 17:10

Cristian


There's a technique called Immersive Full-Screen Mode available in KitKat. Immersive Full-Screen Mode Demo

Example

like image 45
Dmide Avatar answered Oct 14 '22 17:10

Dmide


If you don't want to use the theme @android:style/Theme.NoTitleBar.Fullscreen because you are already using a theme of you own, you can use android:windowFullscreen.

In AndroidManifest.xml:

<activity
  android:name=".ui.activity.MyActivity"
  android:theme="@style/MyTheme">
</activity>

In styles.xml:

<style name="MyTheme"  parent="your parent theme">
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowFullscreen">true</item> 
</style>
like image 79
Ariel Cabib Avatar answered Oct 14 '22 17:10

Ariel Cabib