I have the following XML file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/welcome_bg" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/arrowLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|left"
android:layout_marginLeft="10dp"
android:clickable="true"
android:contentDescription="@string/arrow_left"
android:focusable="true"
android:src="@drawable/arrow_left"
android:visibility="invisible" />
<ImageView
android:id="@+id/arrowRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="10dp"
android:clickable="true"
android:contentDescription="@string/arrow_right"
android:focusable="true"
android:src="@drawable/arrow_right" />
<android.support.v4.view.ViewPager
android:id="@+id/tutorialViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
</RelativeLayout>
My problem is that when the user clicks on the left arrow or the right arrow then the pager should flip, but i am not able to get click events on the leftarrow or the rightarrow ImageView. I am not able to get the event when the arrows are clicked. I have set onClickListeners on both the arrows but they are never called. Can someone please help me with this?
I figured it out. I had to use
rightArrow.bringToFront()andleftArrow.bringToFront(). That brought the buttons to front and i was able to get a click event on them.