gesture

The GestureDetector does not work (example from android developer)

﹥>﹥吖頭↗ 提交于 2020-01-01 08:43:09
问题 I am reading the gesture in android at android developer, and following the tutorial I tried to run the following codes: public class MainActivity extends Activity implements OnGestureListener, OnDoubleTapListener { private static final String DEBUG_TAG = "Gestures"; private GestureDetectorCompat mDetector; // Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View v = new RelativeLayout(this); v

The GestureDetector does not work (example from android developer)

北战南征 提交于 2020-01-01 08:43:06
问题 I am reading the gesture in android at android developer, and following the tutorial I tried to run the following codes: public class MainActivity extends Activity implements OnGestureListener, OnDoubleTapListener { private static final String DEBUG_TAG = "Gestures"; private GestureDetectorCompat mDetector; // Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View v = new RelativeLayout(this); v

How can I implement onTouch function android?

寵の児 提交于 2019-12-30 07:01:08
问题 Hi I want to create aplication which loads large image, and simple gesture I can move across it. I have to image printed out but I can not implement onTouch so it remains stationary. Any help apreseated. Thanks My code for drawing out the picture: @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setStyle(Paint.Style.FILL); // make the entire canvas white paint.setColor(Color.WHITE); canvas.drawPaint(paint); paint.setStrokeWidth(1); paint

Make ViewPager snap with shorter drag

烈酒焚心 提交于 2019-12-29 14:31:31
问题 Is there any way to make the support package ViewPager snap to the next page with a shorter drag? The default behaviour seems to be that even if I drag almost 75% the page still snaps back to the previous page when I let go. I'd like to make the snap threshold shorter and make the ViewPager snap to the next page instead. Note that this applied to drag gesture. A fling gesture requires much shorter gesture already. 回答1: You can do this ad-hoc, without worrying too much about the internals of

Android onTouchListener for entire dialog

孤街浪徒 提交于 2019-12-29 08:07:12
问题 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

Xcode how to hide buttons

落爺英雄遲暮 提交于 2019-12-25 19:30:23
问题 I want to create a gesture so that when the user double taps the screen all the buttons disappear until it is then double tapped again.... Have searched hi and low for the answer but I guess I need to try harder...PLEASE HELP haha would greatly appreciate it if you could specify what goes in the .h and the .m respectfully... sorry for the dumb question once again... 回答1: have you tried button.hidden = YES; ? 回答2: If you intend to have the buttons animate in and out then you may find [button

Why doesn't my approach work to continuously repeat an action till a libgdx scene2d button is pressed and stop it when the button is released?

不打扰是莪最后的温柔 提交于 2019-12-25 14:01:46
问题 I know many questions have been asked to solve similar problem but i could not find an answer to it. Problem : I have made a screen for my libgdx game which looks like the following screenshot. I want the input through touch only.When i press and hold the button labeled 'lower' it decrements the number in the middle once. I want it to keep decrementing until i release the 'lower' button. I have placed the button in a table, which in turn is added on a stage. To achieve what i want i used the

How much would a swipe down/up move a normal vertical RecyclerView/list?

泪湿孤枕 提交于 2019-12-25 09:13:33
问题 Suppose I use this command: adb shell input touchscreen swipe x1 y1 x1 y2 50 How can I know how much pixels will it really scroll? Is there any way to calculate it? 回答1: The default value of the duration parameter is set to 300ms for a reason - anything less than that and your swipe has a much higher chance to become a fling (also depending on the delta of your coordinates) - which will not be precise and/or consistent. So there is no way to find out how many pixels your specific (i.e. with

Android ImageView Gesture/DoubleTap not firing

不羁岁月 提交于 2019-12-25 08:48:00
问题 Ok, so I have this setup ScrollView HorizontalScrollView ImageView I am trying to capture the doubleTap on the Image View.. my code looks like the following: ImageView iv = (ImageView)findViewById(R.id.ImageViewID); iv.setImageDrawable(iv.getResources().getDrawable(R.drawable.someimage)); // Gesture detection detector = new GestureDetector(this,new SimpleOnGestureListener(){ //new myGestureClass()); @Override public boolean onSingleTapUp(MotionEvent e) { // TODO Auto-generated method stub

GestureDetector detect DoubleClick on GridView items

ぃ、小莉子 提交于 2019-12-25 08:01:54
问题 Note: This specific problem is solved, but there are serious follow-up problems. Have a look at GestureDetector - Detect double click in GridView item's although returning false in onTouchEvent() I want to detect double clicks on distinct items in a GridView of images. Therefore I assigned a separate OnTouchListener to each item- imageView in the getView() method of the adapter. The gestureDetector is a member variable of the adapter-class. private GestureDetectorCompat gestureDetector;