I have a RelativeLayout with both an ImageView and a ViewPager. It seems as though the ViewPager sits on top of the ImageView because I had an onClick listener set up for my ImageView and when I implemented the ViewPager the ImageView no longer responds to clicks. Is there any way to "click through" to the ImageView below? In general, is it possible to ignore the "top" view and allow the "bottom" view to respond to click events?
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_gravity="center_horizontal">
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/feed_image_content_description"
android:scaleType="centerCrop" />
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="500dp"
android:scaleType="centerCrop">
<android.support.v4.view.PagerTitleStrip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/custom_viewpagertitlestrip"
android:layout_gravity="top" />
</android.support.v4.view.ViewPager>
</RelativeLayout>
You may want to try to tell ViewPage (and its children) they are not clickable by setting layout attribute android:clickable="false"
(I'd also perhapss set android:focusable="false"
and android:focusableInTouchMode="false"
from XML or call setClickable(false)
from code.