touch-event

DrawerLayout prevents call of MainActivity.onTouchEvent()

可紊 提交于 2019-12-19 03:57:27
问题 I have an app that overrides the onTouchEvent(MotionEvent ev) of the MainActivity to determine Two-Finger-Swipe and Pich-Open / Pinch-Close . Everything works fine until I add the DrawerLayout to the app (like it's described in Creating a Navigation Drawer). Problem: the DrawerLayout prevents the call of onTouchEvent() in the MainActivity. I started to write a CustomDrawerLayout , and try to override the DrawerLayout methods onInterceptTouch() and onTouchEvent() . The only way (I found) to

Javascript touch event: distinguishing finger vs. Apple Pencil

拜拜、爱过 提交于 2019-12-19 02:45:08
问题 In Mobile Safari, is there any way to distinguish whether a touch event is generated by finger or Apple Pencil? 回答1: The TouchList object of a touch event contains detailed information about the touch’s individual points. Among the many properties touchType is probably the most interesting for you as it contains either stylus (Apple Pencil) or direct (finger). var body = document.getElementByTagName('body'); body.addEventListener('touchstart', function(evt){ // should be either "stylus" or

What's the proper way of binding touchstart on React JS?

╄→尐↘猪︶ㄣ 提交于 2019-12-18 14:43:31
问题 I am learning React JS and as of now I cannot find any example on the source code, tests or on the official docs. On the docs the touchStart event is said to be supported but handleTouchStart does not work. The only place I found and example that actually works was on react-touch project. The following code works, but is this the only way of binding? It looks like a cheap workaround for me. var MyHeader = React.createClass({ handleTouchStart: function() { console.log('handleTouchStart'); },

ImageView Drag Limitation In Android

自古美人都是妖i 提交于 2019-12-18 13:23:35
问题 I have an ImageView in a layout and set OnTouchListener on ImageView to drag the ImageView. It's working perfectly. My problem is how can I prevent from move ImageView to out of layout range? This is my code: Activity class: public class RepositionTestActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.reposition_test_layout); ImageView imageView = (ImageView)findViewById(R.id.android); imageView

How to handle Touch Events on a Fragment?

。_饼干妹妹 提交于 2019-12-17 22:38:43
问题 I'm building an interface where I need to process touch events . In particular I would to be able to enable them only to a confined area in a fragment. To better understand the problem, to respect the standards and for the goal of my application, I planned the navigation drawer, which assumes the presence of many fragment (instead of activities). An activity with touch events is implemented quite easily, on the other hand I have read on the internet that with the fragments can become a

adding touch listener for liner layout filled with buttons

断了今生、忘了曾经 提交于 2019-12-17 18:31:52
问题 I added a touch event to a linear layout to respond to swipe gestures, and it works well. However, when i add buttons to the layout, the parent liner layout is ignored. How should I prevent this from happening? LinearLayout ln2 = (LinearLayout) findViewById(R.id.fr2); ln2.setOnTouchListener(swipe); How to i use onInterceptTouch ? 回答1: You should create your own layout and override onInterceptTouchEvent(MotionEvent ev) method of your layout. For Example I created my own layout which extends

Android - Detect End of Long Press

ⅰ亾dé卋堺 提交于 2019-12-17 09:40:40
问题 I am working on application in which a user needs to press and hold a button for a long time. How can I detect the moment that the user: finishes the press or moves their touch position? Thanks 回答1: I think your best bet is to use a combination of the onLongClickListener() and onTouchListener() for that button. You'll need to catch certain events on the touch listener since it will trigger for every touch event. Try something like the following: class Blah extends Activity { private Button

OnTouch Apply glow effect to center of image

前提是你 提交于 2019-12-13 16:14:14
问题 I have a image and I need to apply glow effect to center of the image using OnTouchListener Something like this. How can I achieve this effect? I have looked into examples where we can apply glow effect to outer part of the image. We can achieve this by using a white image and place on top the background image, but can we do it without using images? EDIT I found this post as well but no solution. Android : Image button or button Highlighted with Effect when Pressed 回答1: On the

Enable touch events in node webkit

可紊 提交于 2019-12-13 13:45:50
问题 Im using a custom touchscreen and I want to activate by default the touch event in node-webkit, is that possible? This one tell node-webkit how to open the app and control how the browser behaves. Update: I'm using Ubuntu like OS, all functionality of touch events work like you are using a mouse(For example you need to scroll down with the scroll bar..). The question is how can I tell my OS that I need to use the mobile touch events? Thank you. 回答1: Add "chromium-args": "--touch-events", to

How to detect whether field is touched or clicked?

笑着哭i 提交于 2019-12-13 07:25:13
问题 I override the method like this. newsbtn = new Custom_ButtonField(news, newsactive, newsactive) { protected boolean navigationClick(int status, int time) { Main.getUiApplication().pushScreen( new Menu_PopupMenu(position)); return true; } protected boolean touchEvent(TouchEvent message) { int eventCode = message.getEvent(); if (eventCode == TouchEvent.UNCLICK){ Main.getUiApplication().pushScreen( new Menu_PopupMenu(position)); } return true; } }; add(newsbtn); Here is the Custom_ButtonField