swipe

How to disable snackbar's swipe-to-dismiss behavior

↘锁芯ラ 提交于 2019-11-27 22:20:17
Is there a way to prevent the user from dismissing a snackbar by swiping on it? I have an app that shows a snack bar during network login, I want to avoid it to be dismissed. According to Nikola Despotoski suggestion I've experimented both solutions: private void startSnack(){ loadingSnack = Snackbar.make(findViewById(R.id.email_login_form), getString(R.string.logging_in), Snackbar.LENGTH_INDEFINITE) .setAction("CANCEL", new OnClickListener() { @Override public void onClick(View view) { getOps().cancelLogin(); enableControls(); } }); loadingSnack.getView().setOnTouchListener(new View

Simulate swipe with mouse in javascript

[亡魂溺海] 提交于 2019-11-27 21:42:54
问题 I'm trying to make an image rotator that works on mobile devices using swipe for navigation. I'm also trying to make the same rotator to work on PC browsers but to be able to use the mouse drag to simulate swipe. Any good ideeas? 回答1: You'll want to handle onmousedown , onmousemove , and onmouseup events, keeping track of the mouse position and manipulating your image rotator accordingly. 回答2: I've looked into most of these... I'd recommend looking into Hammer.Js From what little I've seen,

ViewPager disable swiping to a certain direction

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 21:38:21
问题 I want to disable the swiping, but only to the right side. I found a working solution in this answer. Unfortunately, this copies the whole ViewPager source to achieve the goal. Is there any methods just inheriting the existing class and not duplicating? 回答1: I'm not sure this is exactly what you need: I needed a viewpager for a wizard with a max page that the user can't pass it. At the end the solution was in the adapter. I changed the count of the PagerAdapter and this way blocks the user

How to draw a Line in ImageView on Android?

你离开我真会死。 提交于 2019-11-27 21:34:29
I'd Like to know how to draw a Line on ImageView as user swipe their finger ? Could any body explain this ? Or perhaps any Link to get start on this. You must have your own ImageView and override onDraw function. Use something like this public class MyImageView extends ImageView{ public MyImageView(Context context) { super(context); // TODO Auto-generated constructor stub } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint p = new Paint(Paint.ANTI_ALIAS_FLAG); canvas.drawLine(0, 0, 20, 20, p); } } and in your main class create object MyImageView ; and when you touch

React Navigation: Swipe on drawer does not work in Android

↘锁芯ラ 提交于 2019-11-27 19:39:15
I have been searching for a solution for a long time, but surprisingly, I think nobody has faced it yet. So I am posting it. I have created a simple Drawer Navigator with React Navigation V3. I have added a Menu icon, and when I click it, the drawer appears as it should be. But, no hand gesture is working. Swiping from left to right don't do anything. Even when the drawer is open, tapping on empty space doesn't close the drawer. Here is my code: import { createStackNavigator, createSwitchNavigator, createAppContainer, createDrawerNavigator } from 'react-navigation'; import Home from './screens

How to disable ViewPager from swiping in one direction

点点圈 提交于 2019-11-27 19:20:41
I want to allow the user swipe in a ViewPager only from right to left. So once he passed a page he can't come back to it. How can this be done? I tried this solution: public class CustomViewPager extends ViewPager { float lastX = 0; boolean lockScroll = false; public CustomViewPager(Context context, AttributeSet attrs) { super(context, attrs); } public CustomViewPager(Context context) { super(context); } @Override public boolean onTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: lastX = ev.getX(); lockScroll = false; return super.onTouchEvent(ev); case

how to implement fling in android listview

一个人想着一个人 提交于 2019-11-27 19:12:22
I would like to implement onfling (or some similar swipe) in listview in each and every item in list. If I swipe that particular item it should display three buttons next to the name. Is there any idea to implement this. Ads I have implemented this with the help of gesture detection: gestureDetector = new GestureDetector(context, new MyGestureDetector()); gestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }; mList.setOnTouchListener(gestureListener); Use EfficientAdapter rather than listview. Using

Jquery Tools Touch horizontal only disable vertical touch

江枫思渺然 提交于 2019-11-27 18:44:23
问题 I have jquery tools scroller... I like it to have touch option implemented for swipeLeft swipeRight only. When I use touch: true, it does rotates when swipeUp/Down as well.. I followed instructions here: jQuery Tools Scrollable on touch disable vertical scroll and here: http://awardwinningfjords.com/2010/09/22/handling-touch-events-in-jquery-tools-scrollable.html but none seem to work.. any ideas? my Fiddle/demo is below for reference fiddle: http://jsfiddle.net/mmp2m/7/ demo: http://jsfiddle

Looking for Android ViewFlipper Example with Multiple WebViews

浪子不回头ぞ 提交于 2019-11-27 18:38:27
As I am sure you all know. Setting up a WebView is a matter of creating a webview browser client, setting properties and loading a resource into the browser client. I have created several android apps that do exactly that. What i would like to try now is horizontal swiping of different web resources. Imagine a main home page at one url, a categories page at another url and a search page at another url. I would like to create a UI construct that allows swiping from the main home page url view to a view displaying the categories url and then another swipe that shows the view with the search

Detect left/right-swipe on touch-devices, but allow up/down-scrolling

て烟熏妆下的殇ゞ 提交于 2019-11-27 17:51:51
I need to detect and react to left/right-swipes, but want to give the user the ability to scroll on the same element, so as long as he moves his finger only left/right with a maximum up/down movement of X pixels, it should not scroll, but when he exceeds X, it should scroll. So what I did is: var startX, startY, $this = $(this); function touchmove(event) { var touches = event.originalEvent.touches; if (touches && touches.length) { var deltaX = touches[0].pageX - startX; var deltaY = touches[0].pageY - startY; if (Math.abs(deltaY) > 50) { $this.html('X: ' + deltaX + '<br> Y: ' + deltaY + '<br