-2

I searched for some solutions and tried a lot of them, but didn't get the correct answer.

<activity
        android:name=".MainActivity" />
<activity
        android:name=".LoginActivity"
        android:configChanges="keyboardHidden|orientation"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>
<activity
        android:name=".MenuActivity"
        android:label="@string/title_activity_menu"
        android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".ListadoActivity"></activity>

I want to hide the TitleBar in every activity except the MenuActity (because it's a navigation view). Now LoginActivity and MenuActivity are fine, but the rest are not.

Is there any problem for the navigation view? Thank you

Edit: I did the answer cuz I tried every solution that I found here (create a new style, by code, in a single activity, for the whole application, but in every case, my app crash). So I guess the problem is that I created MenuActivity with NavigationView template.

Krum
  • 154
  • 1
  • 2
  • 16
  • You can try the solution shared https://stackoverflow.com/a/2591311/1926621 – Mohit Oct 29 '17 at 23:38
  • Why not create a BaseActivity which you will extend for each activity you don't need a TitleBar, or a Toolbar or ActionBar (if we are talking about that bar). In that base you can setup whatever you feel is common for non-toolbar activities. – miroslavign Oct 29 '17 at 23:39

3 Answers3

2

go to res/styles.xml you will get your theme,

  <!-- 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>

just change your To Theme.AppCompat.Light.NoActionBar

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
xbadal
  • 1,284
  • 2
  • 11
  • 24
0
<activity
        android:theme="@style/Base.Theme.AppCompat"
        android:name=".MainActivity" />
Yunus Kulyyev
  • 1,022
  • 15
  • 26
0

1.Change style in your styles folder

2.Use it in your Activity or application

styles

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

manifest

If you use it in application ,the whole app goes into effect .

If you use it in activity ,it will go into effect in current Activity .

<application
    ...
    android:theme="@style/AppTheme">
// or
<activity
    android:name=".MenuActivity"
    android:label="@string/title_activity_menu"
    android:theme="@style/AppTheme" />
KeLiuyue
  • 8,149
  • 4
  • 25
  • 42