Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Rect;

import android.view.TouchDelegate;
import android.view.View;
import android.widget.Button;

public class Main {
    public static void enlargeBtnTouchScope(View parent, Button btn, Rect rect, float width, float height) {
        rect.top = btn.getTop();
        rect.bottom = btn.getBottom();
        rect.left = btn.getLeft();
        rect.right = btn.getRight();

        rect.top -= height;
        rect.bottom += height;
        rect.left -= width;
        rect.right += width;

        parent.setTouchDelegate(new TouchDelegate(rect, btn));
    }
}