一箫一剑平生意,负尽狂名十五年。这篇文章主要讲述android-23 View.java - dispatchTouchEvent源码相关的知识,希望能为你提供帮助。
public class View implements Drawable.Callback, KeyEvent.Callback, AccessibilityEventSource {/** * Pass the touch screen motion event down to the target view, or this * view if it is the target. * * @param event The motion event to be dispatched. * @return True if the event was handled by the view, false otherwise. */ public boolean dispatchTouchEvent(MotionEvent event) { // If the event should be handled by accessibility focus first. if (event.isTargetAccessibilityFocus()) { // We don‘t have focus or no virtual descendant has it, do not handle the event. if (!isAccessibilityFocusedViewOrHost()) { return false; } // We have focus and got the event, then use normal event dispatch. event.setTargetAccessibilityFocus(false); }boolean result = false; if (mInputEventConsistencyVerifier != null) { mInputEventConsistencyVerifier.onTouchEvent(event, 0); }final int actionMasked = event.getActionMasked(); if (actionMasked == MotionEvent.ACTION_DOWN) { // Defensive cleanup for new gesture stopNestedScroll(); }if (onFilterTouchEventForSecurity(event)) { //noinspection SimplifiableIfStatement ListenerInfo li = mListenerInfo; if (li != null & & li.mOnTouchListener != null & & (mViewFlags & ENABLED_MASK) == ENABLED & & li.mOnTouchListener.onTouch(this, event)) { result = true; }if (!result & & onTouchEvent(event)) { result = true; } }if (!result & & mInputEventConsistencyVerifier != null) { mInputEventConsistencyVerifier.onUnhandledEvent(event, 0); }// Clean up after nested scrolls if this is the end of a gesture; // also cancel it if we tried an ACTION_DOWN but we didn‘t want the rest // of the gesture. if (actionMasked == MotionEvent.ACTION_UP || actionMasked == MotionEvent.ACTION_CANCEL || (actionMasked == MotionEvent.ACTION_DOWN & & !result)) { stopNestedScroll(); }return result; }}
【android-23 View.java - dispatchTouchEvent源码】
推荐阅读
- android-8~23 View.java - dispatchTouchEvent源码
- Android Studio 插件
- Android开发者网址导航
- Android 6.0 闪光灯的使用
- Android下载更新代码
- android 常用URI
- Android MVP + 娉涘瀷锛屽疄鐜颁簡鍙嬪ソVP浜や簰鍙夾ctivity娼滃湪鐨勫唴瀛樻硠闇茬殑浼樺寲
- 在 Android studio 中 配置Gradle 做到 “根据命令行提示符生成指定versionCode, versionName,指定apk的打包输出路径”
- Android问题-新电脑新系统WIN764位上安装简版本的XE8提示“Unit not found: 'System'”