Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 801
Binoy Babu Avatar asked May 09 '12 23:05

Binoy Babu


People also ask

What is an ActionBar?

In Android applications, ActionBar is the element present at the top of the activity screen. It is a salient feature of a mobile application that has a consistent presence over all its activities. It provides a visual structure to the app and contains some of the frequently used elements for the users.

How can I hide app bar in Android?

If you want to hide Action Bar from the entire application (from all Activities and fragments), then you can use this method. Just go to res -> values -> styles. xml and change the base application to “Theme. AppCompat.


1 Answers

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

like image 146
Binoy Babu Avatar answered Sep 19 '22 02:09

Binoy Babu