android - Push out/pull in ActionBar when ListView is scrolled -



android - Push out/pull in ActionBar when ListView is scrolled -

the latest google newsstand app features actionbar , viewpager tab bar eases out top of screen when list below scrolled down. importantly, eases out @ same speed list scrolled. when list scrolled upwards actionbar eases onto screen, again @ same speed list scrolled.

i not referring actionbar hide() , show() methods, instead want know how hide , show actionbar @ same rate list below scrolled.

how achieved? attempts @ finding documented solution have proven unsuccessful help appreciated.

short answer

create fragment subclass serves actionbar replacement. utilize onscrolllistener update fragment's view's translationy after scroll events.

long answer

after digging around actionbar source code, seems there no public method accessing actionbar container view. there's will, there's way.

you can grab reference action bar's view using following:

int resid = getresources().getidentifier("action_bar_container", "id", "android"); view actionbarcontainer = findviewbyid(resid);

disclaimer: action_bar_container private id, it's subject google's whims. utilize @ own risk.

once have action bar's view, can animate you'd like.

i hacked a semi-functional example if you're interested.

hope helps!

android android-actionbar

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -