touch-event

Android: handling clicks on image view inside recycler's view item using touch framework

萝らか妹 提交于 2019-12-03 22:44:32
问题 I am trying to capture the clicks on ImageView which is enclosed inside the RecyclerView item. I have implemented RecyclerView.OnItemTouchListener and has gesture detector process the motion events for normal clicks and long press on RecyclerView item. Since I want to have the same touch framework to process touch event on child views inside the RecylcerView item, I have set View.OnTouchListener with the image view as well, overriding the onTouch implementation returning true hoping that the

Object to process touch event but also let it through

时光总嘲笑我的痴心妄想 提交于 2019-12-03 20:31:19
问题 I want to create an object that will work like MultiPointTouchArea (so it will have touchUpdated signal) but also it would not steal touches, so that objects placed beneath it will receive the touch events as well. The solution may require creating C++ object. Is there a simple way to create such object? Is it possible to process (touch) events without "stealing" them? Any hint will be appreciated. Here is an example of what I am trying to do. I want to touch top Rectangle but at the same

How to swap the bitmap images on View in android?

99封情书 提交于 2019-12-03 20:31:05
I am working with small application for display bubbles images on android screen.I have displayed all bubbles images from resource directory.I have implemented code as follows in view class. onDraw method: @Override protected void onDraw(Canvas canvas) { super.dispatchDraw(canvas); drawImages(canvas); } I have implemented drawImages() method as follows: BitmapFactory.Options opts = new BitmapFactory.Options(); private void drawImages(Canvas canvas) { for(int i = 0; i<MAX_ROWS; i++){ for(int j=0; j<MAX_COLS; j++) { bmp = BitmapFactory.decodeResource(mContext.getResources(), items[i][j],opts);

Prevent default Press but not default Drag in iOS MobileSafari?

狂风中的少年 提交于 2019-12-03 19:01:23
问题 Context : Web app on MobileSafari/iPad, both full-screen and embedded in iframe Goal : Technique that provides custom event handlers for Press and Tap but not Pinch (zoom) or Drag (scroll/pan). We want to provide custom behavior for Press, but to let Safari handle Scroll/Pan/Zoom still. Problem : The two goals seem to be mutually exclusive. To prevent the default behavior for a Press gesture, event.preventDefault must be called in immediate response to ontouchstart. However, to let the

Simulate Long press by Touch events

本秂侑毒 提交于 2019-12-03 15:06:09
问题 How can we simulate long press by touch event? or how can we calculate the time that screen is touched, all in ACTION_DOWN state? 回答1: I have implemented a Touch screen long click finally , thx all: textView.setOnTouchListener(new View.OnTouchListener() { private static final int MIN_CLICK_DURATION = 1000; private long startClickTime; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: longClickActive = false; break; case

How can I avoid animation artifacts on my touch-draggable border-radius element on iPad?

不打扰是莪最后的温柔 提交于 2019-12-03 14:37:51
I’ve written a little example page with elements that are draggable on touch devices (based on code by Peter-Paul Koch ). My example page I have two draggable <div> elements: a green block, and a red ball (made ball-shaped with border-radius ). The dragging is implemented with ontouchstart , ontouchmove and ontouchend , and the "animation" is done by changing the top and left CSS properties of these elements. When I drag the green one, all is roses and ponycorns. But when I drag the red one in Safari on an iPad 1 (running iOS 5.1.1) or an iPad 3 (6.0.1), I get little light red trails where the

Detecting taps on attributed text in a UITextView while the keyboard is showing

て烟熏妆下的殇ゞ 提交于 2019-12-03 13:57:56
This is a supplemental question to a previous answer of mine to the question Detecting taps on attributed text in a UITextView in iOS . I retested the following code with Xcode 7.1.1 and iOS 9.1 and it works fine with the setup described in the answer I linked to. import UIKit class ViewController: UIViewController, UIGestureRecognizerDelegate { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() // Create an attributed string let myString = NSMutableAttributedString(string: "Swift attributed text") // Set an attribute on part of the string let myRange =

ScrollView with children view, how to intercept scroll conditionally

扶醉桌前 提交于 2019-12-03 13:23:46
问题 I have a container ViewGroup , lets call it screen inside a ScrollView . This container view hosts a number of other Views let's call them widgets , and some of them are interested in preventing the ScrollView from scrolling and using the MotionEvent theirselves (for example a pannable image) I can't figure out the proper event intercept strategy to use. ScrollView always processes the event before the children, or the children process the event but scrollview is disabled. I read about

touchend event in ios webkit not firing?

醉酒当歌 提交于 2019-12-03 09:48:17
问题 I'm trying to implement a menu for a ios webkit based app in which the user touches/clicks and holds a menu button ('.menu_item'), after 500ms the sub menu opens (div.slide_up_sub_menu), and a user should be able to slide their finger/mouse up to a submenu li item and release. <li class="menu_item"> ASSET MANAGEMENT <div class="slide_up_sub_menu hidden_menu"> <ul class="submenu"> <li>Unified Naming Convention</li> <li>Version Control</li> </ul> </div> </li> The application should then be able

checking if touchend comes after a drag

风流意气都作罢 提交于 2019-12-03 04:44:26
问题 I have some code which changes the class of a table. On a phone, sometimes the table will be too wide for the screen and the user will drag/scroll about to see the contents. However, when they touch and drag the table around, it triggers touchend on every drag. How do I test to see whether the touchend came as a result of a touch-drag? I tried tracking dragstart and dragend but I couldn't get that to work and it seems an inelegant approach. Is there something I could add to below which would