set/toggle Full Screen - Android User Interface

Android examples for User Interface:Screen Full

Description

set/toggle Full Screen

Demo Code


//package com.java2s;

import android.app.Activity;

import android.view.Window;
import android.view.WindowManager;

public class Main {

    public static void setFullScreen(Activity activity) {
        toggleFullScreen(activity, true);
    }//from  w w  w .j  a v  a  2s. com

    public static void toggleFullScreen(Activity activity, boolean isFull) {
        Window window = activity.getWindow();
        WindowManager.LayoutParams winParams = window.getAttributes();
        final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
        if (isFull) {
            winParams.flags |= bits;
        } else {
            winParams.flags &= ~bits;
        }
        window.setAttributes(winParams);
    }
}

Related Tutorials