0

I have an fullscreen apllication. I'm using requestWindowFeature(Window.FEATURE_NO_TITLE) to remove the title. This works very well for my 4.1.2 Smartphone and the 4.4.2 Emulator. In the 2.2 Emulator, on my 2.2 Smartphone and on my 2.3.6 tablet the title is still being displayed. I tried very much things like changing styles in the Manifest or editing those styles in the styles.xml, nothing works.

Here's my onCreate():

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

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);


    GameData.display = new Display(this);
    setContentView(GameData.display);



    CoreData.mainActivity = this;

    NetworkData.init();
}
Geosearchef
  • 600
  • 1
  • 5
  • 22
  • try this : http://stackoverflow.com/questions/6642192/removing-title-bar-in-android-2-3-gingerbread-causes-problem-with-surfaceview – Itzik Samara Aug 06 '14 at 15:28
  • thx, good idea, but it doesn't work. – Geosearchef Aug 06 '14 at 15:31
  • its better if you change the theme in manifest file. – Pankaj Arora Aug 06 '14 at 15:41
  • [CHECK THIS](http://stackoverflow.com/questions/24201380/make-all-activities-full-screen-no-title-bar-no-activity-bar/24201638#24201638) answer, and give a try,and let me know,if it doesn't works. – Pankaj Arora Aug 06 '14 at 15:42
  • android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen" > requires api leve 14, froyo is api level 8 and gingerbread is 9 and 10. When i try Theme.Black.NoTitleBar.Fullscreen it gives my an error: You need to use Theme.AppCompat theme. I just wanted to mention that i have the support library installed. – Geosearchef Aug 06 '14 at 15:46
  • I created a new Theme with AppTheme as Parent (support library theme) and this change: true now it gives me no errors, and the title is away on 4.2, but not on 2.2. – Geosearchef Aug 06 '14 at 15:54

1 Answers1

3

If you want to remove the title, just add this style into your manifest file.

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

then the problem arises, notifying that you must use a derivative of an appcompat library. this is because you are using the support library v7, & on creating your project, an activity creates which doesn't extends as an Activity class, but ActionBarActivity class.

so, if you really want to use the support library, create the theme that you created under values, values-v11, values-v14 folders & apply your theme on your manifest.

else, change your ActionBarActivity class into Activity class & apply Theme.Black.NoTitleBar theme to your manifest.

hope that it helps.