Question

I updated to 4.3 today and I saw that fullscreen activities are not working properly, more in details, the top bar is always shown.

I tried to run on the emulator (4.2) and works fine.

Anyone has the same problem?

Was it helpful?

Solution

You can do it by two ways

1) Programatically :

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

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);
    }
}

2) Modifying AndroidManifest.xml file:

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

OTHER TIPS

In the manifest:

android:theme="@android:style/Theme.Black.NoTitleBar" >

NOTE: Don't you think it's better to use a single line for attaining the desired task, rather than duplicating the a long code again and again in all the activities?!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top