Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

android - ActionBar Lag in hiding title

I'm using the ActionBarSherlock for my application and this is the code I use to hide the Title of ActionBar :

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayUseLogoEnabled(true);
    setContentView(R.layout.main_fragment);
}

The problem with this is that when the application starts there is a short amount of time when the Logo and Title are shown simultaneously. This looks really ugly, How can I get rid of that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is my solution, we need to define a new style and declare it in the Manifest

<style name="VibhinnaTheme" parent="Theme.Sherlock.Light.ForceOverflow">
    <item name="android:actionBarStyle">@style/VibhinnaTheme.ActionBar</item>
    <item name="actionBarStyle">@style/VibhinnaTheme.ActionBar</item>
</style>

<style name="VibhinnaTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid">
    <item name="android:displayOptions">showHome|useLogo</item>
    <item name="displayOptions">showHome|useLogo</item>
</style>

This link was helpful : LINK


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...