Ustaw TouchListener na widok główny bez nadpisywania widoków dziecka?

Moja aktywność składa się z jednego Framelayout (o nazwie fragment_content), w którym zastępuję / dodaję różne fragmenty. Teraz ustawiłem TouchListener na ten fragment_content, aby zaimplementować „Przesunięcie dwoma palcami” (-> tylko ruch palcem dwoma palcami).

Mam problem z tym, że jak tylko mój Fragment wyjdzie z ListFragment, TouchListener z fragment_content zostanie zignorowany. Wiem, że mogę ustawić touchlistener na listview, ale muszę zaimplementować ustawienia listview (-> przewijanie, listItemClick).

Czy istnieje sposób, aby ustawić Touchlistener na mój widok główny (-> FrameLayout) bez nadpisywania ustawień mojego widoku potomnego (-> ListFragment)?

EDYTOWAĆ

Napisałem klasę MyTouchController, która rozszerza się z FrameLayout. W tej klasie nadpisuję metodę onInterceptTouch ().

W mojej działalności contentView jest main.xml, inicjuję Framelayout:

FrameLayout v = (FrameLayout) findViewById(R.id.main_fragment);

Teraz mam następujący problem: jak zastąpić onInterceptTouchMethod tego main_fragment (-> FrameLayout)?

MyTouchController v = (MyTouchController) findViewById(R.id.main_fragment);

rzuca ClassCastEsception: android.widget.FrameLayout nie można rzutować na MyMenuController (nawet jeśli zadeklaruję MyTouchController w układzie xml).

main.xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <FrameLayout
        android:id="@+id/main_fragment"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

    <FrameLayout 
        android:id="@+id/main_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</FrameLayout>

EDYCJA 2 (rozwiązanie)

main.xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <"pkg-name".MyTouchController
        android:id="@+id/main_fragment"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

    <FrameLayout 
        android:id="@+id/main_menu"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</FrameLayout>

zawyżanie układu kodem:

MyTouchController v = (MyTouchController) findViewById(R.id.main_fragment);

questionAnswers(0)

yourAnswerToTheQuestion