get Center Window Params - Android User Interface

Android examples for User Interface:Window

Description

get Center Window Params

Demo Code


//package com.java2s;

import android.graphics.PixelFormat;

import android.view.Gravity;

import android.view.WindowManager;

public class Main {
    public static WindowManager.LayoutParams getCenterWindowParams() {
        WindowManager.LayoutParams params = new WindowManager.LayoutParams();
        params.type = WindowManager.LayoutParams.TYPE_PHONE;
        params.flags = 0x40000000;/*from   ww w  .java 2 s. c o  m*/
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        params.alpha = 1;
        params.gravity = Gravity.CENTER;
        params.format = PixelFormat.RGBA_8888;
        return params;
    }
}

Related Tutorials