I\'m looking through the Holo.Light theme, and I can\'t seem to find the magic style to override to get rid of the title text that briefly shows up when my app
I'm very new to Android so correct me if I'm wrong, but I think if you decide to use navigation tabs on the Action Bar, they seemed to not be completely left aligned because the title text color is only transparent and hasn't gone away.
<style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:displayOptions">useLogo|showHome</item>
</style>
worked for me.
you have two choice:
first:
getActionBar().setDisplayShowTitleEnabled(false);
If usign getActionBar() produced null pointer exception, you should use getSupportActionBar()
Second
getSupportActionBar().setTitle("your title");
or
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().hide();
If you only want to do it for one activity and perhaps even dynamically, you can also use
ActionBar actionBar = getActionBar();
actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);
In your manifest.xml page you can give address to your activity label. the address is somewhere in your values/strings.xml . then you can change the value of the tag in xml file to null.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="title_main_activity"></string>
</resources>
Write this statement under
setContentView(R.layout.activity_main);
getSupportActionBar().setDisplayShowTitleEnabled(false);
if extending AppCompactActivity use getSupportActionbar() if extending Activity use getActionBar() else it may give
null pointer exception
using android:label="" in AndroidManifest.xml for activity also works but your app won't appear in Recently used apps
i use this code in App manifest
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:logo="@drawable/logo2"
android:label="@string/title_text"
android:theme="@style/Theme.Zinoostyle" >
my logo file is 200*800 pixel and use this code in main activity.java
getActionBar().setDisplayShowTitleEnabled(false);
it will work Corectly