0

My question is maybe stupid but I'm a beginner I have create navigation drawer application in Android Studio with two Activity. In First Activity ( MainActivity), this activity Show Title Bar but the second Activity(Parametre) does not show Title Bar. Hier ist my code.

 Androidmanifest.xml

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

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".SingleViewActivity"></activity>

    <activity android:name=".Playboard"></activity>
    <activity
        android:name=".Parametre"


        android:label="Parametre"></activity>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

  </application>

   </manifest>

            styles.xml


                <resources>

                <!-- Base application theme. -->

                <style name="AppTheme" 
  parent="Theme.AppCompat.Light.DarkActionBar">
                    <!-- Customize your theme here. -->
                    <item name="colorPrimary">@color/colorPrimary</item>
                    <item 
   name="colorPrimaryDark">@color/colorPrimaryDark</item>
                    <item name="colorAccent">@color/colorAccent</item>
                </style>

                <style name="AppTheme.NoActionBar">
                    <item name="windowActionBar">false</item>
                    <item name="windowNoTitle">true</item>
                </style>

                <style name="BaseTheme" parent="AppTheme">
                    <item name="windowActionBar">false</item>
                    <item name="windowNoTitle">true</item>
                </style>

                <style name="AppTheme.AppBarOverlay" 
   parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

                <style name="AppTheme.PopupOverlay" 
   parent="ThemeOverlay.AppCompat.Light" />

            </resources>

4 Answers4

1

Change the style of your Activity by removing this line android:theme="@style/AppTheme.NoActionBar">

1

Delete the line android:theme="@style/AppTheme.NoActionBar". You might want to look into your Theme editor to see what your default Activity looks like

MacLean Sochor
  • 435
  • 5
  • 14
1

You should either add

public classname extends AppCompatActivity 

to have a title bar or

public classname extends Activity

to remove a title bar or you can also use

requestWindowFeature(Window.FEATURE_NO_TITLE)

0

If you are using

extends AppCompatActivity

change it to

extends Activity

in your Java code.

  • Thank you for this code snippet, which might provide some limited, immediate help. A [proper explanation](https://meta.stackexchange.com/q/114762) would greatly improve its long-term value by showing why this is a good solution to the problem and would make it more useful to future readers with other, similar questions. Please [edit](https://meta.stackoverflow.com/posts/360251/edit) your answer to add some explanation, including the assumptions you’ve made. [ref](https://meta.stackoverflow.com/a/360251/8371915) – Alper t. Turker Jan 21 '18 at 15:35