Touch two views at once on android
Here is my layout:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
开发者_运维技巧<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="60dip">
</TextView>
<SeekBar
android:id="@+id/seekBar2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
I want to be able to move the two SeekBars (which I will be using as sliders) at the same time, each with a different finger but at the same time.
How would I achieve this?
This may help (Splitting touches accross views)
You would have to handle touch events yourself. With the multi-pointers (e.g multi-touch) API it's very easy. Just override the onTouchEvent() method or register an OnTouchListener on your buttons.
But Remember multitouch support only in 2.0 or higher version
For more info you can refer This question already asked
Instantiate your Views inside Fragments. Done!
You can see this behavior in action by simultaneously scrolling an email list and an email in the Gmail application on a Honeycomb or Ice Cream Sandwich device.
By default it's probably not possible. You have to define your own view type. Without looking too much on how events are handled. If touch events comes from the parent view. I'd try to override a LinearLayout and give it the capability to handle multi touch point. That way you can add as many scroll bar and it will works with the limit of touch point your screen can handle.
Try changing the minimumSdk to '11' it worked for me.
精彩评论