3

I have a RecyclerView with a StickyHeaderDecor (with Button, ImageView, and TextView inside).

How do I handle the clicks on these components within the StickyHeader?

The library used is UltimateRecyclerView.

This is the code where I setup my recyclerView:

    StickyRecyclerHeadersDecoration headersDecoration =
            new StickyRecyclerHeadersDecoration(adapter);
    recyclerView.addItemDecoration(headersDecoration);
    StickyRecyclerHeadersTouchListener headersTouchListener =
            new StickyRecyclerHeadersTouchListener(recyclerView, headersDecoration);
    headersTouchListener.setOnHeaderClickListener(new StickyRecyclerHeadersTouchListener.OnHeaderClickListener() {
        @Override
        public void onHeaderClick(View headerView, int position, long headerId) {
            Log.d(TAG, "clicked view " + v.getId() + " position:" + position);

            // my code here to handle click (*)
        }
    });
    recyclerView.addOnItemTouchListener(headersTouchListener);

(*) I don't have the possibility to handle click on headerView.

Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
Cristiano
  • 31
  • 1
  • 3
  • Please add code for what you've already attempted and be explicit about what isn't functioning as expected. – thanksd Jan 14 '16 at 17:04

1 Answers1

2

Unfortunately it is not possible to easy handle click of part of item decor. Here is an explanation why.

For Sticky Headers is better use:

Community
  • 1
  • 1
Denis Nek
  • 1,874
  • 3
  • 19
  • 21