How to create an application without title bar?

2

I want to create a app web with a WebView . How can I create an application without the title bar other than fullscreen ?

    
asked by anonymous 08.07.2016 / 21:31

2 answers

3

There are several ways, one of which is to set Window.FEATURE_ACTION_BAR passing getActionBar().hide() to its Activity :

Programmatically

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar().hide();

Using windoActionBar in XML

No res/styles.xml you can do this:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Using the NoActionBar theme feature

However, this can also be done by disabling the ActionBar provided by the theme. The easiest way is to have your theme extend from Theme.AppCompat.NoActionBar (or the light variant) within the file res/styles.xml :

<resources>
  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  </style>
</resources>

Details

16.09.2016 / 16:10
1

Change this part of your AndroidManifest

   ...
    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity
            android:screenOrientation="portrait"
            android:name=".Principal"
            android:theme="@android:style/Theme.Holo.Light.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

The important thing is this line:

 android:theme="@android:style/Theme.Holo.Light.NoActionBar">
    
08.07.2016 / 21:58