GestureOverlayView隐藏其子/隐藏在父级后面

时间:2013-10-03 07:21:45

标签: android android-layout view android-gesture

手势覆盖有问题。

我设计了一个分割视图的画廊。而且我想要手势识别。 之前我没有拆分视图,所以那时我使用手势叠加作为父级,它工作正常。 但现在在分割布局中它没有得到关注。请检查我是否做错了什么。 在此先感谢。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF0000"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="2" >

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:background="#0000FF"
    android:orientation="vertical" >

    <GridView
        android:id="@+id/PhoneImageGrid"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:horizontalSpacing="5dp"
        android:numColumns="1"
        android:stretchMode="columnWidth"
        android:verticalSpacing="5dp" />

    <ProgressBar
        android:id="@+id/progress"
        style="?android:attr/progressBarStyleLargeInverse"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_gravity="center"
        android:indeterminateOnly="true"
        android:visibility="gone" />

    <VideoView
        android:id="@+id/mVideoView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:keepScreenOn="true"
        android:visibility="gone" />

    <android.gesture.GestureOverlayView
        android:id="@+id/gestures"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:eventsInterceptionEnabled="true"
        android:gestureColor="#d80546"
        android:gestureStrokeType="multiple"
        android:orientation="vertical" />
</LinearLayout>

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:background="#00FF00"
    android:orientation="vertical" >
</LinearLayout>

1 个答案:

答案 0 :(得分:0)

// try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:background="#FF0000"
              android:orientation="horizontal"
              android:padding="5dp"
              android:weightSum="2" >

    <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#0000FF"
            android:gravity="center"
            android:orientation="vertical" >

        <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            <GridView
                    android:id="@+id/PhoneImageGrid"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:horizontalSpacing="5dp"
                    android:numColumns="1"
                    android:stretchMode="columnWidth"
                    android:verticalSpacing="5dp"
                    android:layout_centerInParent="true"
                    android:visibility="visible"/>

            <ProgressBar
                    android:id="@+id/progress"
                    style="?android:attr/progressBarStyleLargeInverse"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:indeterminateOnly="true"
                    android:layout_centerInParent="true"
                    android:visibility="gone" />

            <VideoView
                    android:id="@+id/mVideoView"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:keepScreenOn="true"
                    android:layout_centerInParent="true"
                    android:visibility="gone" />

            <android.gesture.GestureOverlayView
                    android:id="@+id/gestures"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:eventsInterceptionEnabled="true"
                    android:gestureColor="#FF0000"
                    android:layout_centerInParent="true"
                    android:gestureStrokeType="multiple"
                    android:orientation="vertical"
                    android:visibility="visible"/>
        </RelativeLayout>

    </LinearLayout>

    <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#00FF00"
            android:orientation="vertical" >
    </LinearLayout>

</LinearLayout>