android-touch-event

Android change recycler view column no. on pinch zoom

删除回忆录丶 提交于 2019-12-19 04:18:22
问题 I have in my layout recycler view for gallery application. I want to incorporate a pinch touch event listner such that the recycler view column no. increases or decreases on pich in and out. I have seen this type of interface in many gallery application. What is the best way to acheive this so that the transition is smooth. Small Video link :- http://sendvid.com/s68fiqpd I tried using below code (as provided by @Yogesh Rathi) but results is not what I want to achieve. import android.content

Prevent single tap from changing SeekBar progress

大兔子大兔子 提交于 2019-12-18 12:04:15
问题 I am using a SeekBar in my Android app. When a user single taps anywhere on the SeekBar , its progress value is changed. I only want the progress value to change when the user slides the SeekBar thumb (just like a UISlider in iOS). I have tried setting the clickable property of the SeekBar to false but that didn't work. How can I achieve the desired behavior? 回答1: I faced the same issue this week and I resolved it using a custom SeekBar: following my code: public class Slider extends SeekBar

android: how can I detect when user touch left 20% of view area?

Deadly 提交于 2019-12-12 17:24:24
问题 In an activity by using public boolean dispatchTouchEvent(MotionEvent ev) how can I know an user is touching left Y-axis of 20% edge area? It should be generic and orientation handled. I don't want to create any hidden view on that. 回答1: Get device width Calculate left 20% width size (from 0 to X) Use event.getX() Check that event.getX() is inside device with 20% example : public class YourActivity extends Activity { private LinearLayout background; private float xValue, yValue,

Draw arrow according to path

て烟熏妆下的殇ゞ 提交于 2019-12-11 09:29:28
问题 Currently I'm drawing a arrow head to my canvas by doing the following: mPaint.setStyle(Style.FILL); float deltaX = this.mPoints[1].x - this.mPoints[3].x; float deltaY = this.mPoints[1].y - this.mPoints[3].y; float frac = (float) 0.1; float point_x_1 = this.mPoints[3].x + (1 - frac) * deltaX + frac * deltaY; float point_y_1 = this.mPoints[3].y + (1 - frac) * deltaY - frac * deltaX; float point_x_2 = this.mPoints[1].x; float point_y_2 = this.mPoints[1].y; float point_x_3 = this.mPoints[3].x +

Android - how to detect a touch on screen is a “scroll” touch?

两盒软妹~` 提交于 2019-12-07 07:05:32
问题 I am creating an android app in Java in which I have a lot of <TextView> around the screen, all of them with onTouchListeners defined. They are wrapped in a <ScrollView> because they occupy more space than available in the screen. My problem is: when I scroll the app, up/down, by touching at the screen and moving my finger up/down, the scroll works as expected but the onTouchListener of the touched <TextView> is also fired (which is probably expected as well) - I don't want that to happen

Android - how to detect a touch on screen is a “scroll” touch?

扶醉桌前 提交于 2019-12-05 15:12:32
I am creating an android app in Java in which I have a lot of <TextView> around the screen, all of them with onTouchListeners defined. They are wrapped in a <ScrollView> because they occupy more space than available in the screen. My problem is: when I scroll the app, up/down, by touching at the screen and moving my finger up/down, the scroll works as expected but the onTouchListener of the touched <TextView> is also fired (which is probably expected as well) - I don't want that to happen though. I want the onTouchListener to be ignored when I'm touching the screen to scroll it. How can I

Android change recycler view column no. on pinch zoom

你。 提交于 2019-12-01 00:19:12
I have in my layout recycler view for gallery application. I want to incorporate a pinch touch event listner such that the recycler view column no. increases or decreases on pich in and out. I have seen this type of interface in many gallery application. What is the best way to acheive this so that the transition is smooth. Small Video link :- http://sendvid.com/s68fiqpd I tried using below code (as provided by @Yogesh Rathi) but results is not what I want to achieve. import android.content.Context; import android.graphics.Canvas; import android.support.annotation.NonNull; import android

Double tap: zoom on Android MapView?

佐手、 提交于 2019-11-27 02:12:56
After a little bit of work my route application works fine. The only thing I just want to add is a double tap zoom in function, but I don't know how. Could you give me a hint? reflog Implement GestureListener to receive doubleTap events. see: Fling gesture detection on grid layout azizbekian I've also been searching for an answer/example, but found nowhere working code. Finally, here's the code that's working for me: MyMapActivity.java public class MyMapActivity extends MapActivity implements OnGestureListener, OnDoubleTapListener { private MapView mapView; @Override public void onCreate

Android: Difference between onInterceptTouchEvent and dispatchTouchEvent?

老子叫甜甜 提交于 2019-11-26 12:34:28
What is the difference between onInterceptTouchEvent and dispatchTouchEvent in Android? According to the android developer guide, both methods can be used to intercept a touch event ( MotionEvent ), but what is the difference? How do onInterceptTouchEvent , dispatchTouchEvent and onTouchEvent interact together within a hierarchy of Views ( ViewGroup )? numan salati The best place to demystify this is the source code. The docs are woefully inadequate about explaining this. dispatchTouchEvent is actually defined on Activity, View and ViewGroup. Think of it as a controller which decides how to

Double tap: zoom on Android MapView?

若如初见. 提交于 2019-11-26 10:01:02
问题 After a little bit of work my route application works fine. The only thing I just want to add is a double tap zoom in function, but I don\'t know how. Could you give me a hint? 回答1: Implement GestureListener to receive doubleTap events. see: Fling gesture detection on grid layout 回答2: I've also been searching for an answer/example, but found nowhere working code. Finally, here's the code that's working for me: MyMapActivity.java public class MyMapActivity extends MapActivity implements