android - Collapsing Toolbar Layout - full height Image and scrolled at start -
i have got layout quite similar one: http://antonioleiva.com/collapsing-toolbar-layout/ - classic approach collapsing toolbar. extend following feature:
the imageview full screen height , @ activity starts automatically scrolled half of height down. when activity starts , user scroll down, behave old way, (at activity starts) when scrolls up, can scroll way make image full screen height size.
what kid of steps need take make behave way imagined?
here the general idea. activity:
public void setupmovingbar(final boolean full) { final display dwidth = getwindowmanager().getdefaultdisplay(); appbarlayout.post(new runnable() { @override public void run() { int heightpx = dwidth.getheight(); if (!full) { heightpx = dwidth.getheight() - (dwidth.getheight() * 1 / 3); } setappbaroffset(heightpx); } }); } private void setappbaroffset(int offsetpx) { coordinatorlayout.layoutparams params = (coordinatorlayout.layoutparams) appbarlayout.getlayoutparams(); appbarlayout.behavior behavior = (appbarlayout.behavior) params.getbehavior(); behavior.onnestedprescroll(clcontent, appbarlayout, null, 0, offsetpx, new int[]{0, 0}); }
Comments
Post a Comment