TonicArtos / SuperSLiM

A layout manager for the RecyclerView with interchangeable linear, grid, and staggered displays of views, all with configurable section headers including the sticky variety as specified in the material design docs.
http://tonicartos.nz
2.12k stars 297 forks source link

How to detect that header sticky? #103

Closed denisokvrn closed 7 years ago

denisokvrn commented 9 years ago

need to show shadow when header is sticky. now i use https://github.com/emilsjolander/StickyListHeaders and setOnStickyHeaderOffsetChangedListener/setOnStickyHeaderChangedListener for this. but I want replace listview on recyclerview. i find this https://github.com/TonicArtos/SuperSLiM/wiki/Sticky-elevation-proposal (but sorry for my english, i can did understand) but dont find this listeners in library

gizthon commented 8 years ago

I solved this problem by this article https://github.com/2013mzhou/blog/blob/master/bug%26extend/Get%20StickyHeaderView%20in%20SuperSLiM.md .It's run well.

when useing like this

final LayoutManager layout = new LayoutManager(getActivity());
        layout.setOnHeaderListener(new LayoutManager.StickyHeaderWatcher() {
            @Override
            public void onStickyStateChanged(View header, int position) {
                Log.i("StickyHeaderWatcher",position+"");
                if (header instanceof TextView) {
                    Log.i("StickyHeaderWatcher", ((TextView) header).getText().toString());
                }
            }
        });