I have a layout that is over top of a viewpager.

The viewpager is functioning as a dynamically changing background.

Upon a long click of the viewpager (long clicking the background), the foreground elements should disappear.

I put a long click listener on the viewpager, but it doesn't respond to this out of the box. This linked answer seems to touch on the subject, but I'm not sure how to implement it, help?

https://stackoverflow.com/a/11303508/727429

I'm also experimenting with other UX (clicks vs buttons vs motion gestures to do the same thing) but for now I want to solve this problem

有帮助吗?

解决方案

The answer is to set a listener inside the viewpager's instantiateItem class.

Basically declare your View within that, and set an onClickListener on that

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top