Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

item underneath header gets clicked #12

Open
ShankyPatel opened this issue Sep 17, 2020 · 4 comments
Open

item underneath header gets clicked #12

ShankyPatel opened this issue Sep 17, 2020 · 4 comments

Comments

@ShankyPatel
Copy link

Hi,

The item underneath my header item gets clicked. If i scroll the list and if there is an item under the header item then whatever the function underneath item has get clicked. How do i resolve it ?

@ShankyPatel
Copy link
Author

just researched and got to know the header item that is drawn over is not clickable. is there any function or method that i can use it to make the button inside drawn header can be clickable ?

@shuhart
Copy link
Owner

shuhart commented Sep 19, 2020

Hi. Try to override onBindHeaderViewHolder() in your adapter and set a click listener on your header view there.

@ShankyPatel
Copy link
Author

hi shuhart, i have already overridden onBindHeaderViewHolder() method but the listener only works when the the header item is clicked which is at 0th position in my list. I have set getHeaderPositionForItem() return position as 0 as i have header only at 0th position does it causing any issues ?

@ganeshsuriya24
Copy link

Setting in click listener onBindViewHolder won't work because the viewHolder is not added in the view hierarchy. Bitmap of the viewholder is drawn on recycler view canvas. Hence the touch event is delivered beneath the header.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants