Android examples for User Interface:Screen Full
toggle Full Screen
//package com.java2s; import android.app.Activity; import android.view.*; public class Main { public static void toggleFullScreen(Activity activity, boolean isFull) { hideTitleBar(activity);/*w w w .j a v a 2 s.c om*/ Window window = activity.getWindow(); WindowManager.LayoutParams params = window.getAttributes(); if (isFull) { params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; window.setAttributes(params); window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } else { params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN); window.setAttributes(params); window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } } public static void hideTitleBar(Activity activity) { activity.requestWindowFeature(Window.FEATURE_NO_TITLE); } }