开发者

consume motion events in layered/stack views

开发者 https://www.devze.com 2023-03-12 15:14 出处:网络
I have two views that are overlayed using a framelayout. What I want is to consume in both views the touch events. I have managed to consume the action_down but once the motion even is dispatched to t

I have two views that are overlayed using a framelayout. What I want is to consume in both views the touch events. I have managed to consume the action_down but once the motion even is dispatched to the view bel开发者_如何学JAVAow the one on top cannot track any motion any more.

Any suggestion?

Thanks in advance!!


If you set your sdk target to version 11 or higher, by default multiple views will be able to accept touch events.

This is further explained here: http://developer.android.com/sdk/android-3.0.html

and scroll down to "Split touch events".

Previously, only a single view could accept touch events at one time. Android 3.0 adds support for splitting touch events across views and even windows, so different views can accept simultaneous touch events. Split touch events is enabled by default when an application targets Android 3.0. That is, when the application has set either the android:minSdkVersion or android:targetSdkVersion attribute's value to "11".

0

精彩评论

暂无评论...
验证码 换一张
取 消