Split touch events

113 篇文章 0 订阅
Split touch events

Previously, only a single view could accept touch events at onetime. Android 3.0 adds support for splitting touch events acrossviews and even windows, so different views can accept simultaneoustouch events.

Split touch events is enabled by default when an application targets Android 3.0. That is, when the application has set eitherthe android:minSdkVersionor android:targetSdkVersion attribute's value to"11".

However, the following properties allow you to disable splittouch events across views inside specific view groups and acrosswindows.

  • The android:splitMotionEventsattribute for view groups allows you to disable split touch eventsthat occur between child views in a layout. For example:
    <LinearLayout android:splitMotionEvents="false" ... >      ...  </LinearLayout>
    

    This way, child views in the linear layout cannot split touchevents—only one view can receive touch events at a time.

  • The android:windowEnableSplitTouchstyle property allows you to disable split touch events acrosswindows, by applying it to a theme for the activity or entireapplication. For example:
    <style name="NoSplitMotionEvents" parent="android:Theme.Holo">      <item name="android:windowEnableSplitTouch">false</item>      ...  </style>
    

    When this theme is applied to an <activity>or <application>,only touch events within the current activity window are accepted.For example, by disabling split touch events across windows, thesystem bar cannot receive touch events at the same time as theactivity. This does not affect whether views inside theactivity can split touch events—by default, the activity can stillsplit touch events across views.

    For more information about creating a theme, read Applying Styles andThemes.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值