I created a RelativeLayout containing an ImageView and a SlidingDrawer. I set an onClickListener on the ImageView and another one on the content part of the SlidingDrawer. When the SlidingDrawer is open and I click on its content part, the onClick event of the ImageView is triggered.
Why? Isn’t the SlidingDrawer above the ImageView?
Thanks
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:background="@drawable/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/whip"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="wrap_content"
android:layout_height="53dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:handle="@+id/facebook_icon"
android:content="@+id/facebook_contacts">
<ImageView
android:id="@+id/facebook_icon"
android:layout_width="55dp"
android:layout_height="53dp"
android:src="@drawable/facebook_handler_off" />
<ImageView android:id="@+id/facebook_contacts"
android:layout_width="265dp"
android:layout_height="53dp"
android:src="@drawable/facebook_content" />
</SlidingDrawer>
</RelativeLayout>
Try to intercept the mouse evensts with the implementation of
boolean onInterceptTouchEvent(MotionEvent event)
Giving to the doc, this method “intercept all touch screen motion events”.
You return true if you want to treat the specific MotionEvent (giving in parameters) with the SlidingDrawer.
Look the
onTouchEvent(MotionEvent event)too 🙂http://developer.android.com/reference/android/widget/SlidingDrawer.html#onInterceptTouchEvent(android.view.MotionEvent)