recyclerview - How can an AppBarLayout be prevented from expanding? -


i have layout looks this:

<framelayout>     <scrollview (empty view, set gone)>     <linearlayout (loading screen, set gone)>     <coordinatorlayout>          <appbarlayout>              <relativelayout scroll|enteralways|enteralwayscollapsed>          </appbarlayout>          <recyclerview layout_behavior set>          <nestedscrollview (variation of empty layout, set gone)>      </coordinatorlayout> </framelayout> 

in appbarlayout there horizontal recyclerview cells, below main recyclerview contains different kind of cell , scrolls vertically. works great when scrolling - appbarlayout appears , disappears perfectly.

the problem comes when searching , limiting results in 2 recyclerviews. when either recyclerview empty, should disappear - , when top horizontal recyclerview empty whole appbarlayout should disappear.

to achieve this, calling appbarlayout.setexpanded(false) - working. however, after calling if scroll vertical recyclerview or down appbarlayout expands , shows itself. i've tried resetting layoutparams scrollflags 0, should disable scrolling. appbarlayout no longer scrolls - still expands.

how can totally prevent appbarlayout expanding? need close it, , force stay closed until reset no matter user does.

in place had scroll listener set expand view @ top. triggering expand should not have.


Comments