touch-event

Why are touch event listeners seemingly preventing the selection of google translate languages on the iphone or ipad?

自作多情 提交于 2019-12-02 00:47:18
问题 I've a problem with the google translate widget. When using the iphone or the ipad I can't select the language to translate to. I can click the first button, but then when the languages menu appears and I tap a language, the menu immediately disappears and the click registers on the element that was behind the menu. This problem only occurs under very specific situations which I will outline below. The problem described below has been observed on an iphone4 ios5.0.1 and ipad2 ios 7.0.6. The

Why are touch event listeners seemingly preventing the selection of google translate languages on the iphone or ipad?

走远了吗. 提交于 2019-12-01 21:57:44
I've a problem with the google translate widget. When using the iphone or the ipad I can't select the language to translate to. I can click the first button, but then when the languages menu appears and I tap a language, the menu immediately disappears and the click registers on the element that was behind the menu. This problem only occurs under very specific situations which I will outline below. The problem described below has been observed on an iphone4 ios5.0.1 and ipad2 ios 7.0.6. The problem has NOT been observed on firefox 29.0.1, chrome 31.0.1650.63 m or internet explorer 11. JSfiddle

How to setOnTouchListener() on a ListPreference?

北城以北 提交于 2019-12-01 18:21:28
Handling onTouchEvent on a view is straightforward as every view has the setOnTouchListener() method to do just that. Alas, although ListPreference is a view, it isn't defined in a layout XML, and thus can't be accessed via findViewById(). So... I don't seem to figure out how to setOnTouchListener() for it. My idea was to get a reference to it in PreferenceActivity's onCreate(), then getDialog(). getCurrentFocus() but at that particular moment in time, it has no focus and not even a dialog (getDialog() returns null, confirmed). Any idea how to work around this? Use

Android: Child view sharing pressed state from its parent view in Jelly Bean

大城市里の小女人 提交于 2019-12-01 18:20:02
code comment: 1. A RelativeLayout Clickable attr is set to true, which has a child view whose Clickable attr is set to false. 2. No any duplicateParentState attr, in other words, duplicateParentState is false. 3. The child view is TextView whose textColor is color selector, so it can check pressed state. behaviour: before level16, when clicking RelativeLayout, pressed state is not transmitted to his chlid view. However in level 16 or later, it can. Reason: setPressed------>dispatchSetPressed------>transmit pressed state to children view----->childView.setPressed View.java onTouchEvent in level

How to setOnTouchListener() on a ListPreference?

孤人 提交于 2019-12-01 18:14:11
问题 Handling onTouchEvent on a view is straightforward as every view has the setOnTouchListener() method to do just that. Alas, although ListPreference is a view, it isn't defined in a layout XML, and thus can't be accessed via findViewById(). So... I don't seem to figure out how to setOnTouchListener() for it. My idea was to get a reference to it in PreferenceActivity's onCreate(), then getDialog().getCurrentFocus() but at that particular moment in time, it has no focus and not even a dialog

Android: Child view sharing pressed state from its parent view in Jelly Bean

时光总嘲笑我的痴心妄想 提交于 2019-12-01 17:43:02
问题 code comment: 1. A RelativeLayout Clickable attr is set to true, which has a child view whose Clickable attr is set to false. 2. No any duplicateParentState attr, in other words, duplicateParentState is false. 3. The child view is TextView whose textColor is color selector, so it can check pressed state. behaviour: before level16, when clicking RelativeLayout, pressed state is not transmitted to his chlid view. However in level 16 or later, it can. Reason: setPressed------>dispatchSetPressed-

Get the element under a touchend

[亡魂溺海] 提交于 2019-12-01 15:22:28
As the touchend event is bind to the element where the touchstart is fired, how can I get the element at the position where the finger leaves, when this is outside of the element where the event was binded to. You could use the document.elementFromPoint method, passing it the coordinates of the event: $('#element').on("touchend",function(event){ var endTarget = document.elementFromPoint( event.originalEvent.touches[0].pageX, event.originalEvent.touches[0].pageY ); }); EDIT: Found some good article about getting elements at specific coordinates. http://www.zehnet.de/2010/11/19/document

Custom Scrollbar Maths in jQuery / JavaScript

左心房为你撑大大i 提交于 2019-12-01 11:08:25
I am currently working on a project which uses a custom scroll plugin (written by me) to allow an element to be scrolled in touch devices, as well as desktop browsers. Everything is working correctly (including velocity and deceleration a la iOS). However, the only problem that remains is calculating the top (or left) position of the scrollbar when a user scrolls. I have calculated the height of the scrollbar with the following formular: Math.round((container.height() / content.height()) * 100); This seems to compute the correct height of the bar, but now I need a formular to work out by how

Custom Scrollbar Maths in jQuery / JavaScript

↘锁芯ラ 提交于 2019-12-01 07:28:15
问题 I am currently working on a project which uses a custom scroll plugin (written by me) to allow an element to be scrolled in touch devices, as well as desktop browsers. Everything is working correctly (including velocity and deceleration a la iOS). However, the only problem that remains is calculating the top (or left) position of the scrollbar when a user scrolls. I have calculated the height of the scrollbar with the following formular: Math.round((container.height() / content.height()) *

Is there an equivalent for dispatchTouchEvent() from Activity in Dialog or DialogFragment

无人久伴 提交于 2019-12-01 04:32:07
问题 I need to intercept all touch events in the application to monitor for a custom activity time out. Currently I use dispatchTouchEvent() in my activities but this is not called if I have a dialog on the screen. Does any one know if there any way I can have this same functionality with a dialog being present? Thanks 回答1: For use dispatchTouchEvent() in DialogFragment, override onCreateDialog and return a custom Dialog with dispatchTouchEvent (in your custom DialogFragment). Exemple, for dismiss