How do you remove the title text from the Android

2019-01-10 02:55发布

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 first launches.

How can I do that?

20条回答
\"骚年 ilove
2楼-- · 2019-01-10 03:50
ActionBar actionBar = getActionBar();
actionBar.setTitle("");
查看更多
淡お忘
3楼-- · 2019-01-10 03:51
getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().hide();

hope this will help

查看更多
女痞
4楼-- · 2019-01-10 03:52

I think this is the right answer:

<style name="AppTheme" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
    <item name="android:displayOptions">showHome|useLogo</item>
    <item name="displayOptions">showHome|useLogo</item>
</style>
查看更多
We Are One
5楼-- · 2019-01-10 03:52

In your Manifest

<activity android:name=".ActivityHere"
     android:label="">
查看更多
祖国的老花朵
6楼-- · 2019-01-10 03:53

Simply extends your java file from AppCompatActivity and do this:

ActionBar actionBar = getSupportActionBar(); // support.v7
actionBar.setTitle(" ");
查看更多
孤傲高冷的网名
7楼-- · 2019-01-10 03:56

You can change the style applied to each activity, or if you only want to change the behavior for a specific activity, you can try this:

setDisplayOptions(int options, int mask) --- Set selected display 
  or
setDisplayOptions(int options) --- Set display options.

To display title on actionbar, set display options in onCreate()

getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);

To hide title on actionbar.

getSupportActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);

Details here.

查看更多
登录 后发表回答