1

i am trying to make a mini-game program and i cant get the title bar to go away i have already tried the following getActionBar().hide(); , requestWindowFeature(Window.FEATURE_NO_TITLE); here is what i have so far.

package com.example.marcus.game;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;

public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}
}

XML

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
tools:context="com.example.marcus.game.MainActivity"
android:background="#752fdf">
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="Large Text"
    android:id="@+id/textView"
    android:layout_alignParentTop="true"
    android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
    android:layout_centerHorizontal="true" />
</RelativeLayout>
Marcus Mardis
  • 83
  • 1
  • 1
  • 8

2 Answers2

2

Add this style to your styles.xml:

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

You can also add :

    <item name="android:windowTranslucentStatus">true</item>

to your v21 style.

Change your androidmanifest.xml to use the style:

    <activity
        android:name="MainActivity"
        android:theme="@style/AppTheme.Fullscreen"/>
Andre Classen
  • 3,868
  • 3
  • 26
  • 36
0

see About the Full Screen And No Titlebar from manifest

add

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

to your activity or application in the manifest

and change

"extends AppCompatActivity"

to

"extends Activity"
Community
  • 1
  • 1
lganzzzo
  • 558
  • 3
  • 10