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
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.
You can try changing AndroidManifest.xml like this
If your context is an activity you can call overridePendingTransition:
So, programmatically: