How can find the intersection between two ImageView ???
For this I tried this but no progress
Can anyone suggest me to do this?
Code snnipet
imageView = (ImageView) findViewById(R.id.imageView1);
imageView2 = (ImageView) findViewById(R.id.imageView2);
Rect rect =new Rect();
imageView.getHitRect(rect);
Rect rect1 = new Rect();
imageView2.getHitRect(rect1);
if(Rect.intersects(rect, rect1)){
Toast.makeText(this, "hoho", Toast.LENGTH_SHORT).show();
}
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"
tools:context=".IntersectActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_launcher" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="121dp"
android:src="@drawable/ic_launcher" />
</RelativeLayout>