onfling

Why is my SimpleOnGestureListener not functioning?

拟墨画扇 提交于 2019-12-04 06:28:50
问题 I'm using my own GestureDetector class to detect a left|right onFling event. Everything I see looks good in my code but nothing happens...? I need the added functionality beyond my toggle button that opens|closes a navigation view in my fragments. The toggle calls on a method in my AnimationLayout class as follows: public void toggleSidebar() { if (mContent.getAnimation() != null) { return; } if (mOpened) { /* opened, make close animation */ mAnimation = new TranslateAnimation(0,

Android - Trouble with swipe gesture

余生颓废 提交于 2019-12-01 20:11:28
I'm trying to implement a swipe gesture in my app. I've made almost all code but it doesn't work. Here is the code I have in my Activity: // Swipe detector gestureDetector = new GestureDetector(new SwipeGesture(this)); gestureListener = new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { Log.e("", "It works"); return gestureDetector.onTouchEvent(event); } }; LinearLayout root = (LinearLayout) findViewById(R.id.rules_root); root.setOnTouchListener(gestureListener); When I touch the screen, the logcat displays it works . Here he my the code of the class SwipeGesture :

Android - Trouble with swipe gesture

假如想象 提交于 2019-12-01 19:41:01
问题 I'm trying to implement a swipe gesture in my app. I've made almost all code but it doesn't work. Here is the code I have in my Activity: // Swipe detector gestureDetector = new GestureDetector(new SwipeGesture(this)); gestureListener = new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { Log.e("", "It works"); return gestureDetector.onTouchEvent(event); } }; LinearLayout root = (LinearLayout) findViewById(R.id.rules_root); root.setOnTouchListener(gestureListener); When

Showing a delete button on swipe in a listview for Android

青春壹個敷衍的年華 提交于 2019-11-30 05:22:49
Expanding on another Stackoverflow question, I've implemented some gesture detection code so that I can detect when a row in my listview (which is in a FrameLayout) has been swiped. I followed the question/answer by Damian here about how to get the individual row/view from the adapter. How to get location (on screen) of row in listview I have code in my onFling that gets the view for the row, and tries to make a delete button that is set as invisible in my xml layout to visible. However, this doesn't happen. I was wondering how I make a button visible in a listview on a swipe? class

how to disable fling in android gallery

会有一股神秘感。 提交于 2019-11-29 12:02:19
I have a custom gallery in my app and after doing some testing I've decided that I don't want the gallery to navigate with finger swipes. I've set up a left and right button to control it instead. Now I want to figure out how to disable the onFling method. I've tried this.setEnabled(false); which didn't work, and tried this.setClickable(false); which didn't work... also my overridden onFling() method has everything except the return(true); commented out.... not sure what else to try! Any ideas?? Thanks :) Ljdawson A better approach (as described here ) is to override the fling method in your

Android onTouchListener for entire dialog

假装没事ソ 提交于 2019-11-29 11:59:53
I have a dialog to choose files from. This dialog contains a listview to show directories and files and has an onItemClickListener for navigation purposes. How can I react to fling events to go up in the directory structure? I tried setting an OnTouchListener on the root RelativeLayout to dispatches touch events to my GestureListener: final GestureDetector detector = new GestureDetector(new MyGestureDetector(tvCurrentPath)); dialog.findViewById(R.id.rlFilelist).setOnTouchListener(new OnTouchListener() { public boolean onTouch(View view, MotionEvent e) { detector.onTouchEvent(e); return false;

Android - Gesture Detection (Swipe up/down) on particular view

假如想象 提交于 2019-11-28 22:55:31
I am trying to implement the OnGestureListener in Android. I have three TextViews in my layout. What i am trying to achieve is to set Gesture Listener for two of the textViews . Here is the layout - <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rlMain" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/tvOne" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginBottom="10dp" android:layout_marginTop="5dp" android:gravity

how to disable fling in android gallery

笑着哭i 提交于 2019-11-28 05:35:59
问题 I have a custom gallery in my app and after doing some testing I've decided that I don't want the gallery to navigate with finger swipes. I've set up a left and right button to control it instead. Now I want to figure out how to disable the onFling method. I've tried this.setEnabled(false); which didn't work, and tried this.setClickable(false); which didn't work... also my overridden onFling() method has everything except the return(true); commented out.... not sure what else to try! Any

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

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