Home > front end >  Why action bar didn't show up after calling the show Unit?
Why action bar didn't show up after calling the show Unit?

Time:11-18

I have 2 formats of action bar, I want to hide home action bar when I am in detail page and want to hide detail action bar when I am in home page. When I start the app, it directs me to home page and it shows me home action bar without showing detail action bar as I expected. I click something on home page that directs me to detail page and when I am on detail page, it also shows detail action bar without showing home action bar as I expected. But trouble comes when I get back to home page again using up button, it doesn't show the home action bar. So the home page doesn't have any action bar displayed. Why using show() doesn't bring back the home action bar?

CodePudding user response:

I would suggest to change from relying on the detail fragment to set the home activity's action bar and instead rely on the home activity to set its own action bar.

For example:

  • In the onPause() of the home activity, you could add supportActionBar?.hide().
  • Then in the onResume() of the home activity you could add the line supportActionBar?.show().

Try that out and see if that works.

  • Related