hide - Hiding Scrolling activity title in android studio -
i have created scrolling activity.
i want hide activity title (banglalink latest offers).
but
i want show activity title @ stage (banglalink latest offers).
is possible do? if yes, how?
your best bet convert normal activity (with scrollview child), start actionbar hidden (using hide() call below (put inside oncreate()).
then put coloured backgroiund @ top of screen inside scrollview. finally, can programmatically toggle between hiding title (and actionbar), showing header background (or vice versa) when needed adding horizontal scroll listener/observer.
the listener toggle actionbar , header view depending on how far user has scrolled down.
e.g:
add observer inside onstart():
hsv.getviewtreeobserver().addonscrollchangedlistener( new viewtreeobserver.onscrollchangedlistener() { @override public void onscrollchanged() { log.i(tag,"scroll:"+hsv.getscrollx());}}); // todo adjust scrollx value decide on hide or show call: if (hsv.getscrollx() > 100) getactionbar().show(); mheaderlayoutview.setvisibility(view.gone); else getactionbar().hide(); mheaderlayoutview.setvisibily(view.visible) ...
note: hsv horizontalscrollview works.
note, if using support libraries (e.g. activity class extends appcompatactivity), code change to:
getsupportactionbar().hide();
im not sure if getscrollx in pixels or dp (job research).
hope helps!
Comments
Post a Comment