get Default Layout Params - Android User Interface

Android examples for User Interface:Layout

Description

get Default Layout Params

Demo Code


//package com.java2s;

import android.graphics.PixelFormat;

import android.view.WindowManager;

public class Main {
    private static WindowManager.LayoutParams sysParams;

    public static WindowManager.LayoutParams getDefaultLayoutParams() {
        sysParams = new WindowManager.LayoutParams();
        WindowManager.LayoutParams params = sysParams;
        params.height = WindowManager.LayoutParams.WRAP_CONTENT;
        params.width = WindowManager.LayoutParams.WRAP_CONTENT;
        params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
        params.format = PixelFormat.TRANSLUCENT;
        //params.windowAnimations = com.android.internal.R.style.Animation_Toast;
        params.type = WindowManager.LayoutParams.TYPE_PRIORITY_PHONE; //?????UI
        params.setTitle("Toast");

        return params;
    }/*from   ww  w .  j a  v a 2 s  .c o m*/
}

Related Tutorials