简体   繁体   中英

swipe gesture! android in lazy swipe app

the lazy swipe app opens when user swipes from bottom left corner of the screen diagonally. how is this done? how lazy swipe app is only seen as an arc, and not on the whole screen? I want to make an app like that? please tell me how should I start to make that kind of swipe gesture?

I donw know the app, but there are serval ways to do that. basically you have to override onInterceptTouchEvent() and onTouchEvent() for your View

or

you can override Activity.onTouchEvent() to let the activity intercept all touch events.

Have a look here: https://developer.android.com/training/gestures/viewgroup.html

Update: After reviewing LazySwipe : Lazy Swipe is using the same mechanism / android api as Facebook chats heads. It's not an activity. Basically its a Service . Here is a discussion and implementation . There are also libraries on Github (I have never used that one).

But as you see it's not an Activiy, hence you can not use Activity.onTouch() . However, you can display and interact any regular View or ViewGroup . Therefore, overriding ViewGoroup.onInterceptTouchEvent() and ViewGorup.onTouchEvent() is possible. So yes, you can detect Swipe gestures. There are alredy some gesture detectors build in on Android that you can use. Have a look here: https://developer.android.com/training/gestures/scroll.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM