Android: ActionBar as a stock browser

I want my ActionBar to act like in the Android / Android browser: It appears at the top of the page, but as the user scrolls down, the panel flies out of view, and if you scroll up to the top, the panel again appears, but will be hiding after some time, when he does this, he does not affect the main view.

I tried to implement automatic hiding using timers, but when the ActionBar hides, it moves upward in the scrollable view from below, so it looks like my whole page moves upward, instead of the ActionBar floating above the top of the view.

+8
android android-actionbar view
source share
2 answers

You are looking for an action bar overlay mode in combination with a quick return template. This is a function when the view becomes visible from above, when the user scrolls a bit. See This Great Blog Post Describes This Template. Don’t miss the sample implementation of Roman Nurik from Google.

Turn on the requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY) blend mode to setContentView() or set the theme attribute android:windowActionBarOverlay to true .

+5
source share

Have you tried the blend mode on ActionBar, getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY) ?
Then add marginTop to your main layout.

+2
source share

All Articles