سؤال

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