android - How to Use Collapsing ToolBar with a ListView instead of a Recycler View -


does know how implement collapsing toolbar using listview instead of recycler view?

to make woks should to:

  1. implement nestedscrollingchild in custom listview implementation.

  2. add field private final nestedscrollingchildhelper mscrollingchildhelper; , init in constructors

  3. delegate methods nestedscrollingchild

  4. invoke setnestedscrollingenabled(true); after mscrollingchildhelper initialization

here list view implementation example:

public class nestedscrollinglistview extends listview implements nestedscrollingchild {      private final nestedscrollingchildhelper mscrollingchildhelper;      public nestedscrollinglistview(context context) {        super(context);        mscrollingchildhelper = new nestedscrollingchildhelper(this);        setnestedscrollingenabled(true);     }      public nestedscrollinglistview(context context, attributeset attrs) {        super(context, attrs);        mscrollingchildhelper = new nestedscrollingchildhelper(this);        setnestedscrollingenabled(true);     }      @override     public void setnestedscrollingenabled(boolean enabled) {        mscrollingchildhelper.setnestedscrollingenabled(enabled);     }      @override     public boolean isnestedscrollingenabled() {        return mscrollingchildhelper.isnestedscrollingenabled();     }      @override     public boolean startnestedscroll(int axes) {        return mscrollingchildhelper.startnestedscroll(axes);     }      @override     public void stopnestedscroll() {         mscrollingchildhelper.stopnestedscroll();     }      @override     public boolean hasnestedscrollingparent() {         return mscrollingchildhelper.hasnestedscrollingparent();     }      @override     public boolean dispatchnestedscroll(int dxconsumed, int dyconsumed, int dxunconsumed,                                     int dyunconsumed, int[] offsetinwindow) {         return mscrollingchildhelper.dispatchnestedscroll(dxconsumed, dyconsumed,             dxunconsumed, dyunconsumed, offsetinwindow);     }      @override     public boolean dispatchnestedprescroll(int dx, int dy, int[] consumed, int[] offsetinwindow) {         return mscrollingchildhelper.dispatchnestedprescroll(dx, dy, consumed, offsetinwindow);     }      @override     public boolean dispatchnestedfling(float velocityx, float velocityy, boolean consumed) {         return mscrollingchildhelper.dispatchnestedfling(velocityx, velocityy, consumed);     }      @override     public boolean dispatchnestedprefling(float velocityx, float velocityy) {         return mscrollingchildhelper.dispatchnestedprefling(velocityx, velocityy);     } } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -