【问题标题】:dividing screen into 6 areas with detecting multi touches将屏幕分为 6 个区域并检测多点触摸
【发布时间】:2014-09-06 09:13:15
【问题描述】:

我是 android 的绝对初学者,我找到了一个检测多点触控的代码和另一个将屏幕分成 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>

检测多点触控的布局:

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

我的问题是如何结合这两种布局?以及如何知道每次触摸在哪个区域? 提前致谢

【问题讨论】:

标签: android


【解决方案1】:

制作您的布局的父级 - RelativeLayout 并添加一个带有 ma​​tch_parentView 到所有视图上方的两侧尺寸您想要的。使用标志View.INVISIBLE 隐藏此视图。 并将此视图添加到此视图ScaleDetector。就是这样。

【讨论】:

  • 嘿,谢谢您的回复,但我可以通过Skype与您联系吗?
  • @HayaD 当然。捕捉 - pandarium.shustikov
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-04-18
  • 1970-01-01
  • 2012-03-04
  • 1970-01-01
相关资源
最近更新 更多