ViewPager和longclick [英] ViewPager and longclick
问题描述
我有一个布局是在一个viewpager之上。
I have a layout that is over top of a viewpager.
该viewpager是充当一个动态变化的背景。
The viewpager is functioning as a dynamically changing background.
一旦viewpager的(长单击背景),前台要素应该消失。一个长按
Upon a long click of the viewpager (long clicking the background), the foreground elements should disappear.
我穿上viewpager长时间点击监听器,但它并没有对此作出回应开箱。此链接答案似乎触及到这个问题,但我不知道如何实现它,帮助吗?
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?
http://stackoverflow.com/a/11303508/727429
我也与其他试验UX(点击按钮VS VS运动手势做同样的事情),但现在我想解决这个问题。
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
推荐答案
答案是设置viewpager的instantiateItem类中的监听器。
The answer is to set a listener inside the viewpager's instantiateItem class.
基本上声明中您的视图,并就设置onClickListener
Basically declare your View within that, and set an onClickListener on that
这篇关于ViewPager和longclick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!