gestures

Android: velocity-based ViewPager scrolling

送分小仙女□ 提交于 2019-11-27 06:10:33
The way the ViewPager scrolls right now is by one item per gesture. It treats flinging gesture the same way no matter if it's full screen fast fling or slow dragging; at the end page advances one step only. Is there any projects perhaps or examples that would add velocity-based flinging that scrolls multiple items based on velocity of the existing fling (if it still in progress) and scrolls further if the flinging gesture is wide and fast? And if there's none where to start with something like this? P.S. The bounty is offered. Please no answers with references to Gallery or

How to programmatically trigger the touch event in android?

做~自己de王妃 提交于 2019-11-27 03:55:45
I would like to trigger a touch event like this: First the finger is touch down at the (0,50%) of the screen and slide to the (50%,50%) of the screen, and exit (move the finger off the screen) I have found some thing like this: MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, x, y, pressure, size, metaState, xPrecision, yPrecision, deviceId, edgeFlags); onTouchEvent(event); However, how to emulate the above case? Do I need to create 2 event ? onTouchDown , onMove etc.... ? Thanks for helping. bstar55 // Obtain MotionEvent object long downTime = SystemClock.uptimeMillis();

The UICollectionView “swipe-away” in iOS7 app manager?

て烟熏妆下的殇ゞ 提交于 2019-11-27 01:41:22
问题 On any 2014+ iPhone or iPad, double-click the home button to see the "app manager" This is a left-right UICollectionView BUT it has a "swipe-away" gesture .. swipe up. How is it done? It's not so easy to "remove" a cell from a UICollectionView. Footnote for googlers .. for the general problem of "peeling off", "tearing away", one cell from a collection view, here's a full tidy explanation: https://stackoverflow.com/a/24339705/294884 Hope it helps someone. 回答1: It can be much simpler than the

JavaFX ListView with touch events for scrolling up and down

我只是一个虾纸丫 提交于 2019-11-26 22:10:13
问题 I would like to implement a scrollable ListView with gestures, just like in mobiles and tablets, to scroll up and down my list with a finger. But my current list selects an item as soon as I click down on the list. How can I achieve this? I couldn't find any example at the Oracle tutorials. private ObservableList<Document> items = FXCollections.observableArrayList(); @FXML ListView<Document> listView; { ... listView.setItems(items); listView.getStylesheets().add("style/listview.css");

What is the difference between Pan and Swipe in iOS?

孤街浪徒 提交于 2019-11-26 21:33:43
Sounds simple .. Hold the Trackpad, move the finger, release .. But somehow swipe is not being triggered (pan is triggered instead) UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:v action:@selector(handleSwipe:)]; swipeGesture.direction= UISwipeGestureRecognizerDirectionUp; [v addGestureRecognizer:swipeGesture]; Pan is recognized by the above sequence instead. UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:v action:@selector(handlePan:)]; [v addGestureRecognizer: panGesture]; If pan is commented, swipe is

Adding Fling Gesture to an image view - Android

房东的猫 提交于 2019-11-26 21:33:00
Okay I have been referencing the code here: Fling gesture detection on grid layout but just can not get it to work. In my main activity I have a simple image defined. I want to detect a fling on the image. Here is my code below. The onclick method at the bottom is empty. Is it because of this? I left it blank because in the other code sample its not what I want. I just want a simple toast to pop up saying fling right or fling left. public class GestureRightLeft extends Activity implements OnClickListener { ImageView peek; private static final int SWIPE_MIN_DISTANCE = 120; private static final

Android: Detect if user touches and drags out of button region?

别来无恙 提交于 2019-11-26 19:22:33
问题 In Android, how can we detect if a user touches on button and drags out of region of this button? 回答1: Check the MotionEvent.MOVE_OUTSIDE: Check the MotionEvent.MOVE: private Rect rect; // Variable rect to hold the bounds of the view public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN){ // Construct a rect of the view's bounds rect = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); } if(event.getAction() == MotionEvent.ACTION_MOVE

Android: velocity-based ViewPager scrolling

拥有回忆 提交于 2019-11-26 11:55:33
问题 The way the ViewPager scrolls right now is by one item per gesture. It treats flinging gesture the same way no matter if it\'s full screen fast fling or slow dragging; at the end page advances one step only. Is there any projects perhaps or examples that would add velocity-based flinging that scrolls multiple items based on velocity of the existing fling (if it still in progress) and scrolls further if the flinging gesture is wide and fast? And if there\'s none where to start with something

How to programmatically trigger the touch event in android?

这一生的挚爱 提交于 2019-11-26 09:34:40
问题 I would like to trigger a touch event like this: First the finger is touch down at the (0,50%) of the screen and slide to the (50%,50%) of the screen, and exit (move the finger off the screen) I have found some thing like this: MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, x, y, pressure, size, metaState, xPrecision, yPrecision, deviceId, edgeFlags); onTouchEvent(event); However, how to emulate the above case? Do I need to create 2 event ? onTouchDown , onMove etc.... ?

Adding Fling Gesture to an image view - Android

戏子无情 提交于 2019-11-26 09:06:20
问题 Okay I have been referencing the code here: Fling gesture detection on grid layout but just can not get it to work. In my main activity I have a simple image defined. I want to detect a fling on the image. Here is my code below. The onclick method at the bottom is empty. Is it because of this? I left it blank because in the other code sample its not what I want. I just want a simple toast to pop up saying fling right or fling left. public class GestureRightLeft extends Activity implements