Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.view.WindowManager;
import android.graphics.PixelFormat;
import android.view.Gravity;

public class Main {
    public static WindowManager.LayoutParams makeLayout(int x, int y, int width, int height) {
        WindowManager.LayoutParams ll_lp;

        //Just a sample layout parameters.
        ll_lp = new WindowManager.LayoutParams();
        ll_lp.format = PixelFormat.OPAQUE;
        ll_lp.height = height;
        ll_lp.width = width;
        ll_lp.gravity = Gravity.LEFT | Gravity.TOP;
        ll_lp.x = x;
        ll_lp.y = y;
        ll_lp.token = null;
        //ll_lp.gravity |= Gravity.CENTER_HORIZONTAL;
        //ll_lp.gravity |= Gravity.CENTER_VERTICAL;
        ll_lp.type = WindowManager.LayoutParams.TYPE_APPLICATION;
        ll_lp.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
        ll_lp.flags = ll_lp.flags | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
        ll_lp.flags = ll_lp.flags | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;

        return ll_lp;
    }
}