gesture

SwipeRefreshLayout and Vertical ViewPager Touch Issues

梦想与她 提交于 2021-02-08 10:18:35
问题 I have a Activity with Custom SwipeRefreshLayout and a Vertical ViewPager which swipes vertically. (basically a deck of cards which can be refershed by using swipe to refresh). So Now when i try to swipe the Vertical Viewpager SwipeRefreshLayout handles the touch event and refresh the layout and the view pager's page does't move. Two things i tried but with no luck: Enable swipe to refresh layout only when user starts from the toolbar. MotionEvent.ACTION_DOWN event getY() gives toolbar's y

Handle Touch Events inside WebView in android

99封情书 提交于 2021-02-08 08:16:57
问题 I had created WebView that loads html files from the asset folder. Now when i am going to put GestureDetecter in that WebView it stops working ScrollView & links inside html page. but when i removes GestureDetecter both ScrollView & links works fine. Following is my complete code, (I have used two html files 1.html & 2.html, you can use any html files instead of it which can allows scrolling and put both files into asset folder) import android.app.Activity; import android.content.Context;

How to implement double tap for surface view in android

前提是你 提交于 2021-02-04 12:27:05
问题 Please tell how to implement double tap for SurfaceView in Android using gesture detector. Can anybody provide code example? 回答1: You could try following.. actually i tested this and it works pretty well: 1) Extend GestureDetector.SimpleOnGestureListener and override it's onDoubleTap() method: class DoubleTapGestureDetector extends GestureDetector.SimpleOnGestureListener { @Override public boolean onDoubleTap(MotionEvent e) { Log.d("TAG", "Double Tap Detected ..."); return true; } } 2)

Why does MagnificationGesture only update the state once in SwiftUI?

限于喜欢 提交于 2021-01-29 09:16:57
问题 I wish to have the following view respond to the magnification gestures, but it only works the first time. The view can be magnified as expected, but after the view is released, subsequent touches do not trigger the gesture. Is there a way to have the gesture work continuously? struct Card: View { @State var magScale: CGFloat = 1 var magnification: some Gesture { MagnificationGesture().onChanged { gesture in magScale = gesture } } var body: some View { Rectangle() .frame(width: 200, height:

Cancel button click when finger is dragged off

丶灬走出姿态 提交于 2021-01-29 07:22:06
问题 Goal Cancel custom button's onResponderRelease() when the user's finger moves off of it. Is there a standard way of doing this that I'm not finding online? What I've tried Using onLayout to grab the component's position and the onResponderMove 's GestureResponderEvent 's pageX/pageY to calculate the click area. However, onLayout only gets the position relative to the parent, so this doesn't work well with modals. const handleMove = (e: GestureResponderEvent) => { const { pageX, pageY } = e

Flutter PhotoView - Rotation about the point between the fingers

时间秒杀一切 提交于 2021-01-28 12:13:47
问题 I am using PhotoView (https://pub.dev/packages/photo_view) to showcase a map saved in gif format. I need the ability to zoom and rotate. My code: class MapView extends StatelessWidget { @override Widget build(BuildContext context) { return PhotoView( imageProvider: AssetImage("assets/maps/my_map.gif"), enableRotation: true, backgroundDecoration: BoxDecoration( color: Colors.white, ), ); } } The problem is that the picture is rotated relative to the center of the picture, which is inconvenient

Problem with gesture in Xcode 12 and iOS 14

喜你入骨 提交于 2021-01-21 13:50:06
问题 I have a problem after upgrading to Xcode 12 and iOS 14. Scenario: I have a Nested UITableView: nestedTableView . Like below class GAllowGestureEventPassTableView: UITableView, UIGestureRecognizerDelegate { var allowGestureEventPassViews: [UIView] = [] func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { panGestureRecognizer.cancelsTouchesInView = false guard let otherView =

Problem with gesture in Xcode 12 and iOS 14

痴心易碎 提交于 2021-01-21 13:48:55
问题 I have a problem after upgrading to Xcode 12 and iOS 14. Scenario: I have a Nested UITableView: nestedTableView . Like below class GAllowGestureEventPassTableView: UITableView, UIGestureRecognizerDelegate { var allowGestureEventPassViews: [UIView] = [] func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool { panGestureRecognizer.cancelsTouchesInView = false guard let otherView =

Detecting Shake Gesture by CoreMotion

人走茶凉 提交于 2020-12-06 15:56:31
问题 I want to detect device shake using coreMotion framework for iOS 7. Can anyone help me out how to do this ? I wrote code described below in my viewDidAppear CMMotionManager *motionManager = [[CMMotionManager alloc] init]; motionManager.deviceMotionUpdateInterval = 1.0/60.0; __block double myAcceleration; [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { myAcceleration = motion.userAcceleration.y; CATransform3D

Detecting Shake Gesture by CoreMotion

北战南征 提交于 2020-12-06 15:56:18
问题 I want to detect device shake using coreMotion framework for iOS 7. Can anyone help me out how to do this ? I wrote code described below in my viewDidAppear CMMotionManager *motionManager = [[CMMotionManager alloc] init]; motionManager.deviceMotionUpdateInterval = 1.0/60.0; __block double myAcceleration; [motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { myAcceleration = motion.userAcceleration.y; CATransform3D