문제

I am trying to display a popup window in my view class (not in activity). Whenever the user touches a particular rectangle for like 3 sec, the popup window would appear.

Following this tutorial i found online(http://android-er.blogspot.sg/2012/03/example-of-using-popupwindow.html), it created the popup window in an activity class. How do i go about implementing this in a view class instead and how to check if the touch by user is at least 3 sec?

Please advice. Thank you.

도움이 되었습니까?

해결책

TO make a popup window, use the PopupWindow class http://developer.android.com/reference/android/widget/PopupWindow.html

To see if a touch is 3 seconds, override the view's onTouch and store when a touch_down occurs and when a touch_up occurs check how long ago that down was.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top