skip to Main Content

I am trying to show the title bar of my android app on some layouts but not on others. I navigate between layouts without a problem and I call getSupportActionBar().hide(); or getSupportActionBar().show(); without problems, the titlebar does indeed show or hide when I want it to. However, there is an animation which is very ugly and annoying plus it causes some strange graphics problems (black background in my app but it shows a white background in the place of the title bar during its animation)

There is a method for disabling the animation but it does not seem to work at all. How can I have a title bar one one activity but not the other without having an annoying animation to show/hide it? And why cant I just call the method and have it work as it should?

The method I am trying to call is getSupportActionBar().setShowHideAnimationEnabled(false);

it is worth noting that my app is extremely simple and only has two layouts and one java activity. I just inflate two different layouts to show on my one activity.

How it looks like currently: https://i.imgur.com/djTWokI.mp4

3

Answers


  1. Chosen as BEST ANSWER

    I sort of solved it myself by creating a custom titlebar which I have full control over. What really frustrated me was that setShowHideAnimationEnabled(boolean) doesnt seem to work properly and I couldnt find any official documentation about it.

    Googling for it only gave me results from like 2010 about how to enable animations but when animations are enabled by default, I wanted to remove them.

    Anyway, turning the actionbar off in the entire application/activity is possible and that is what I did, I then created my own custom actionbar layout and added it to the page(s) that I want to utilize it.


  2. <activity android:name=".MainActivity"
              android:label="@string/app_name"
              android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
    

    You can try changing AndroidManifest.xml like this

    Login or Signup to reply.
  3. If your context is an activity you can call overridePendingTransition:

    Call immediately after one of the flavors of startActivity(Intent) or
    finish specifying an explicit transition animation to perform next.

    So, programmatically:

    startActivity(new Intent(CurrentActivity.this, YourNextActivity.class));
    overridePendingTransition(0, 0);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search