把屏幕划分成6个区域与检测多触摸
问题描述:
我是一个绝对的初学者与Android,我发现检测multitouches一个代码且将屏幕分成6个区域 这里另一个码对每个码的布局:把屏幕划分成6个区域与检测多触摸
<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>
布局检测multitouches:
<com.example.multitouch.MultitouchView
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
我的问题是如何将这两种布局结合起来?以及如何知道每个区域在哪里? 在此先感谢
答
让您的布局的父 - RelativeLayout
并添加View
与match_parent双方规模以上你想要的所有意见。使用标志View.INVISIBLE
隐藏此视图。 并添加到此视图ScaleDetector
。就这样。
+0
嘿,谢谢你的回复,但我可以与Skype联系吗? – 2014-09-06 18:49:19
+0
@HayaD当然。赶上 - pandarium.shustikov – 2014-10-02 14:20:38
reffer this [post](http://stackoverflow.com/a/10463119/3326331) – 2014-09-06 09:21:47