In my app there is this title bar at the top where the overflow menu would be, but I don\'t need settings and only have one screen. When I change the theme like described in
Best way is to use actionbar function setTitle()
if you wish to show logo or have some other stuff in you actionBar but dont want to see name of the app, write this code in MainActivity.java or anywhere you wish to hide title in onCreate
:
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowHomeEnabled(true);
actionBar.setIcon(R.mipmap.full_white_logo_m); // display logo
actionBar.setTitle(""); // hide title
This way your app won't have reason to crash.
Just call setTitle(null);
in onCreate()
In the manifest file Change:
android:theme="@style/AppTheme" >
android:theme="@style/Theme.AppCompat.NoActionBar"
Try changing styles to NoActionBar if that doesn't works add this code to your main activity
protected void onCreate(Bundle savedInstanceState) {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
setContentView(R.layout.activity_main);
}
This was working for me on values/styles.xml
add items:
`<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>`
Go to styles.xml and change .DarkActionBar
for .NoActionBar
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
becomes
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
if colors are irrelevant to your app, you can actually go for
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />