is ImageView Colliding - Android User Interface

Android examples for User Interface:ImageView

Description

is ImageView Colliding

Demo Code


//package com.java2s;

import android.graphics.Rect;

import android.widget.ImageView;

public class Main {
    static boolean isColliding(ImageView imageView1, ImageView imageView2) {
        Rect imageView1Rect = new Rect();
        Rect imageView2Rect = new Rect();
        imageView1.getHitRect(imageView1Rect);
        imageView2.getHitRect(imageView2Rect);
        return (Rect.intersects(imageView1Rect, imageView2Rect));
    }// w  w  w.j  a  va2s. c  om
}

Related Tutorials