android - Using CollapsingToolbarLayout setCollapseMode -
i trying set collapsemode of new collapsingtoolbarlayout
i can create new params child , can assign it. not change layout_scrollflags think need edit.
collapsingtoolbarlayout.layoutparams mparams = new collapsingtoolbarlayout.layoutparams(mcollapsing.getlayoutparams()); mparams.setcollapsemode(collapsingtoolbarlayout.layoutparams.collapse_mode_off); mcollapsing.getchildat(0).setlayoutparams(mparams);
so turn on , off scroll mode.
has done yet?
after few hours of playing this.
turns out layout_scrollflags layoutparams in appbarlayout class.
you can current flags using
appbarlayout.layoutparams mparams = (appbarlayout.layoutparams) abbar.getchildat(0).getlayoutparams(); int currentscrollflags = mparams.getscrollflags();
this means can turn off using
mparams.setscrollflags(0);
some may ask why, need user make selection in view bellow, once has happened turn flag 3, scroll|exituntilcollapsed can use
appbarlayout.layoutparams.scroll_flag_enter_always appbarlayout.layoutparams.scroll_flag_exit_until_collapsed appbarlayout.layoutparams.scroll_flag_enter_always appbarlayout.layoutparams.scroll_flag_enter_always_collapsed
hope helps someone.
Comments
Post a Comment