I have to different subviews I want to include in my view like this in my XML-File:
<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/myLayout"/>
    <!--Include this as default and if user swipes right-->
    <include layout="@layout/dashboard_user_view" android:id="duv"/>
    <!--Include this if the user swipes left-->
    <include layout="@layout/dashboard_widgets_view" android:id="dwv"/>
Including one layout works fine, but now I want to switch between both of them.
So then I added the OnSwipeTouchListener from this tutorial, and I call it in my Kotlin class like this:
val myLayout = findViewById<RelativeLayout>(R.id.myLayout)
    myLayout.setOnTouchListener(object : OnSwipeTouchListener(this) {
        override fun onSwipeRight() {
            //TODO
        }
        override fun onSwipeLeft() {
            //TODO
        }
        override fun onTouch(v: View, event: MotionEvent): Boolean {
            return gestureDetector.onTouchEvent(event)
        }
    })
This gives me an error which says:
CustomView "RelativeLayout" has setOnTouchListener called on it but does not override...
So how do I put the if-statement to determine which view to show in my Kotlin Class? Or do I put it in my XML? And how will the swiping action work that way?
(I hope you understand my problem)
 
     
    