Question

I have problem with gesture overlay.

I have designed a gallery with split view. And over that I want gesture recognition. Earlier I didnt have a split view, so that time I was using gesture overlay as parent, it was working fine. But now in split layout its not getting focus. Please check if I m doing something wrong. Thanks in Advance.

<?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>

Was it helpful?

Solution

// 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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top