get Left Top Window Layout - Android User Interface

Android examples for User Interface:Window

Description

get Left Top Window Layout

Demo Code


//package com.java2s;

import android.graphics.PixelFormat;

import android.view.Gravity;

import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;

public class Main {

    public static WindowManager.LayoutParams getLeftTopWindowLayout() {
        WindowManager.LayoutParams params = new WindowManager.LayoutParams();
        params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT
                | WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
        params.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL
                | LayoutParams.FLAG_NOT_FOCUSABLE;
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        params.alpha = 1;/*from   w  w w  .  j  a  v a2s  .  c om*/
        params.gravity = Gravity.LEFT | Gravity.TOP;
        params.format = PixelFormat.RGBA_8888;
        return params;
    }
}

Related Tutorials