are Two View OverLapping by their rectangle - Android User Interface

Android examples for User Interface:View

Description

are Two View OverLapping by their rectangle

Demo Code


//package com.java2s;

public class Main {
    public static boolean isOverLapping(float x1, float y1, int width1,
            int height1, float x2, float y2, int width2, int height2) {
        if (x1 <= x2 && x1 + width1 <= x2) {
            return false;
        } else if (x2 <= x1 && x2 + width2 <= x1) {
            return false;
        } else if (y1 <= y2 && y1 + height1 <= y2) {
            return false;
        } else if (y2 <= y1 && y2 + height2 <= y1) {
            return false;
        }// www  . j  av  a2 s. c om
        return true;
    }
}

Related Tutorials