I want my ActionBar to act like it does in the stock/default Android browser: It visible at the top of the page, but as the user scrolls down, the bar scrolls out of view, how ever if you scroll the page upward towards the top, the bar comes in to view again, but will hide after some time out, when it does this, it does not affect the underlying view.
I've tried implementing auto-hiding using timers but when the ActionBar hides, it moves up the scrollable view underneath so it looks as is my whole page shifts up instead of the ActionBar floating over the top of the view.
You are looking for the action bar overlay mode in combination with the Quick Return pattern. That is the feature, where a view becomes visible on top again when the user scrolls up a little. See this excellent blog post describing this pattern. Don't miss the example implementation by Roman Nurik from Google.
Enable the overlay mode by requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY)
before setContentView()
or by setting the theme attribute android:windowActionBarOverlay
to true
.
Did you try the overlay mode on the ActionBar, getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY)
?
Then add a marginTop to your main layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With