Removing the TitleBar from the android app

4

I'm starting on android, and I know very little! I'm developing slowly and with each change I save the apk and see it running on my cell phone. I noticed that there is a bar in the app with the name of the application! I would like to take this bar! I saw several tutorials on the internet, but none worked! I do not know if I'm actually doing it wrong or if there is compatibility!

I use Android Studio and in the theme I put "NoTitleBar", but it does not work!

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="proj.beta" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

The Title_Bar I'm referring to is in the following image!

    
asked by anonymous 13.09.2015 / 21:59

7 answers

5

You can configure by Manifest to leave the app fullScreen.

  

AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@mipmap/logo"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar">

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

  

Via Java code

// onCreate()
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);

// setContentView()
    
13.09.2015 / 22:23
5

Friend is bearded, goes in res/values/styles.xml

modify parent="Theme.AppCompat.Light.DarkActionBar" to parent="Theme.AppCompat.Light.NoActionBar" and make a rebuild and it's ready to emulate.

    
27.08.2016 / 21:37
1

You can in the onCreate() method of your Activity

//Remove a title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    
13.09.2015 / 22:55
1

In your styles.xml file comes with a default theme:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- Customize your theme here. -->
</style>

To remove ActionBar , create a style with the same parent of the default style, including only NoActionBar :

  <style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.NoActionBar">

    </style>

In the Activity you wanted to remove ActionBar, add the theme:

  <activity
        android:name=".MainActivity"
        android:theme="@style/AppThemeNoActionBar" >
    
14.09.2015 / 13:29
0

Try changing the theme of your activity to:

android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen"

Att. Jeiferson

    
14.09.2015 / 02:26
0

You can do the following

// Dependendo do tipo de activitt, talvez voce precise usari gerSupportActionBar()
ActionBar acb = getActionBar();
If(acb != null){
    acb.hide();
}

ActionBar is where the menu title is the application. Do not worry about another type of bar at the moment, if testing should be what you need.

EDIT: Ah, you should do this in the onCreate of the actvity in question.

    
14.09.2015 / 15:08
0

Simple, just add a line to onCreate

 @Override 
        protected void onCreate(Bundle savedInstanceState) {          
            super.onCreate(savedInstanceState);
            getSupportActionBar().hide(); //Esta linha contém o código necessário.
            setContentView(R.layout.sua_activity);
        }
    
03.07.2017 / 22:33