So far, we've seen how to manage onTouchEvent() events on our custom view, but that was on a view occupying the whole screen size, so it was a bit of a simple approach. If we want to include or view inside a ViewGroup that also handles touch events, for example, a ScrollView, what do we've to change?
Let's change the layout for this one:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="@dimen/activity_vertical_margin" tools:context="com.packt.rrafols.customview.MainActivity"> <ScrollView android:layout_width="match_parent" ...