View pager onInterceptTouchEvent not generating event
Asked Answered
H

1

0

I have written an custom ViewPager but it's not generating event for Continuous Action.Move. On touch it generate DOWN once and MOVE event 2-3 time and that's it. Then after it not generate MOVE event.

Parent XML code.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <example.animation.com.CustomPager
        android:id="@+id/pager"
        android:background="#123456"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />



</FrameLayout>

Added Child Fragment XML implementation:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fmParent"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txtIndex" />

</FrameLayout>

Any suggestion if I am missing anything here.

Harcourt answered 19/2, 2015 at 12:3 Comment(7)
generating event? what do you mean?Outsider
Finger move on ViewPager not generating any further event through onInterceptTouchEvent(MotionEvent ev).Harcourt
if you return true, events got dispatched to onTouchOutsider
yes...here I require to intercept touch event. Since Child Fragment I mentioned here may be a list. So as far as I know using onInterceptTouchEvent I have to find whether event should pass to child or parent should handle this. Reference: developer.android.com/training/gestures/viewgroup.htmlHarcourt
sorry i don't understand what you really meanOutsider
So here I am using an ViewPager which contain Fragment as an child. Fragment has Expandable list view. But this List view displayed in half of the part of screen. Now I need to scroll Up (beyond upper half part) this list view on detection if two finger get placed. If single finger using to scroll then allow in bottom half part of screen...any suggestion?Harcourt
Let us continue this discussion in chat.Harcourt
J
0

Probably some view catch the event, so if just the ViewPager should catch the touches you can change the return of the ViewPagerfrom:

return super.onInterceptTouchEvent(ev);

to:

return true;
Jade answered 19/2, 2015 at 12:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.