Comments (4)
刚看了下,确实有你说的这个问题。在那里return false就可以了。我之前也没注意,很感谢你的提出。
from materialdesigndemo.
这是为什么啊??
我查了一下在onTouchEvent中,返回true表示消费了这次事件,返回false表示未消费。
按理不是应该消费了就不再次执行了吗?
我抓了下日志,是if那句判断执行了四次,有时候是五次,好不可思议啊
from materialdesigndemo.
这是事件消费与传递的知识点,如果不清楚可以再回去看看。返回false就是本次的事件序列,后面的MOVE和UP都不由这个View处理了,然而返回true就是代表这个View会消费掉整个的事件序列后面的MOVE和UP都会由这个View来处理,你知道的只要你的手指没离开这个View MOVE会一直执行。这也就是会出现多次的原因。
from materialdesigndemo.
谢谢你
from materialdesigndemo.
Related Issues (11)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialdesigndemo.