Android : dividing screen into 6 areas with detecting multi touches

on Saturday, September 6, 2014


I'm an absolute beginner with android, I found a code that detects multitouches and another code that splits the screen into 6 areas here is the layout for each code :



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >

<LinearLayout
android:background="@android:color/black"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
</LinearLayout>

<LinearLayout
android:background="@android:color/white"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
</LinearLayout>
</LinearLayout>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >

<LinearLayout
android:background="@android:color/black"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
</LinearLayout>

<LinearLayout
android:background="@android:color/darker_gray"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
</LinearLayout>


</LinearLayout>

<LinearLayout

android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >

<LinearLayout
android:background="@android:color/white"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
</LinearLayout>

<LinearLayout
android:background="@android:color/black"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal" >
</LinearLayout>


</LinearLayout>


layout for detecting multitouches :



<com.example.multitouch.MultitouchView
android:layout_width="match_parent"
android:layout_height="match_parent"
/>


my question is how to combine these two layouts? and how to know each touch in which area lies ? Thanks in advance


0 comments:

Post a Comment