现在的位置: 首页 > 综合 > 正文

Android事件传递机制【Touch事件】

2013年11月07日 ⁄ 综合 ⁄ 共 754字 ⁄ 字号 评论关闭
Android中提供了ViewGroup、View、Activity三个等级的Touch事件处理。也就是说,这三个地方都有事件回调方法。

测试DEMO视图结构:
<com .orgcent.eventtest.EventLinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#032d3d"
    android:orientation="vertical" >
    <com .orgcent.eventtest.EventTextView
        android:id="@+id/tvEvent"
        android:layout_width="fill_parent"
        android:layout_height="100dp"
        android:gravity="center"
        android:textColor="@android:color/black"
        android:background="@android:color/white"
        android:text="Activity - ViewGroup - View Event http://orgcent.com dispatch Test"/>
</com>
至于三者之间的执行顺序,将在下面详细阐述:

原文地址:Android事件传递机制【Touch事件】 | http://orgcent.com/android-touch-event-mechanism/

抱歉!评论已关闭.