Closed Alireza-Razavi closed 2 years ago
HeaderOnClick doesn't work for me.
binding.historyRv.setHasFixedSize(true); binding.historyRv.setLayoutManager(new LinearLayoutManager(this)); adapter = new UserHistoryAdapter(this, tcuList); StickyRecyclerHeadersDecoration decoration = new StickyRecyclerHeadersDecoration(adapter); adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onChanged() { decoration.invalidateHeaders(); } }); binding.historyRv.addItemDecoration(decoration); binding.historyRv.setAdapter(adapter); StickyRecyclerHeadersTouchListener touchListener = new StickyRecyclerHeadersTouchListener(binding.historyRv, decoration); touchListener.setOnHeaderClickListener( (header, position, headerId) -> { showMessage("Header clicked!"); }); binding.historyRv.addOnItemTouchListener(touchListener);
You can refer to my project:https://github.com/wanglaohushiwo/StickyHeaderFooterRecyclerView
@@###
HeaderOnClick doesn't work for me.