Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How could I implement an OnClickListener for the header image? #8

Open
Zordid opened this issue Jun 26, 2013 · 13 comments
Open

How could I implement an OnClickListener for the header image? #8

Zordid opened this issue Jun 26, 2013 · 13 comments

Comments

@Zordid
Copy link

Zordid commented Jun 26, 2013

I struggle with getting the OnClick event of my header view. Tried to set the image that I got in my header layout as clickable and assigned a listener - but that does not work, apparently because the layout is more complex at the end and other elements obstruct the way and are on top of my ImageView?

Could you extend your library, your FadingActionBarHelper, to allow adding of a listener via a simple setOnHeaderClickListener(OnClickListener) helper method?

Thanks!

@ManuelPeinado
Copy link
Owner

That's a good idea, let me look into it.

@Zordid
Copy link
Author

Zordid commented Jun 28, 2013

I managed to get the header completely selectable by changing one line in createListView method:

listView.addHeaderView(mMarginView, null, true);

The last boolean value switches "isSelectable" feature of the applied header. That works. But would be nicer if that was a possibility from "the outside" without changing your code. :-)

@ManuelPeinado
Copy link
Owner

Absolutely, I'll try to add that to the next version of the lib.

@digitalclutch
Copy link

+1

@Nammari
Copy link

Nammari commented Dec 7, 2013

did you add this feature ????

@ghost
Copy link

ghost commented Dec 18, 2013

Also interested to know. If it was added (in one way or another) could you tell us how to use it?

@ManuelPeinado
Copy link
Owner

Hi guys. I didn't implement this for v3, sorry. I'll give it a try over the next few days, please stay tuned.

@jpshelley
Copy link

@Zordid That would work for the list view but what about the other views? Seems more scalable to have an overall method by allowing the class to implement a View.OnClickListener like you stated first. cc: @ManuelPeinado

@joakim5937x
Copy link

@Zordid I changed isSelectable parameter like you described and it do make the header clickable but sadly not my button inside the header view. Is there any way of enable childs of the header to be clickable?

@JasonAndujar
Copy link

Would love to have this feature implemented for other layouts than listview. Currently I am using your library with a relativelayout in a scrollview. Has anyone figured out how to make the header clickable in these layouts? Thanks

@iGio90
Copy link

iGio90 commented Feb 5, 2014

this was quite easy... feel free to implement:

https://gist.github.com/iGio90/8828996

@deRonbrown
Copy link

See #64 for my solution. Extended @iGio90's idea but allows for the header view to handle touch events if it wants (by setting an OnClickListener on the background image view or button that may exist). Otherwise, the content view will scroll as expected. @ManuelPeinado, thoughts?

@Collinux
Copy link

@deRonbrown thank you, this works perfectly!

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

No branches or pull requests

10 participants