alexvasilkov / GestureViews

ImageView and FrameLayout with gestures control and position animation
Apache License 2.0
2.37k stars 384 forks source link

GestureFrameLayout is not working if I place a GridView inside it #94

Closed mazid1 closed 6 years ago

mazid1 commented 6 years ago
<com.alexvasilkov.gestures.views.GestureFrameLayout
    android:id="@+id/gestureView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorAccent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <!-- GestureFrameLayout can contain only one child -->

    <FrameLayout
        android:layout_width="match_parent"
        android:background="#@color/colorLime"
        android:layout_height="match_parent">

        <GridView 
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/gridview"
            android:background="#@color/colorYellow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </FrameLayout>

</com.alexvasilkov.gestures.views.GestureFrameLayout>

Now if I touch Yellow area (GridView area) then gesture is not working. But if I touch Lime area (FrameLayout area) then gesture is working fine. Can anyone tell me what's going wrong here?

alexvasilkov commented 6 years ago

GridView intercepts touch gestures, that is expected. Same as if you'll put GridView into ScrollView.

What would you expect when nesting GestureFrameLayout and GridView?

mazid1 commented 6 years ago

Thank you very much for pointing out my fault. Now I've solved my problem by extending GestureFrameLayout and overriding onInterceptTouchEvent.