1.去除App中的標題
requestWindowFeature(Window.FEATURE_NO_TITLE);
2.App的全螢幕畫面
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
3.設定螢幕為縱向
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
4.設定螢幕為橫向
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
5.取消休眠模式
PowerManager pm;
PowerManager.WakeLock wakeLock;
pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, this.getClass().getCanonicalName());
wakeLock.acquire(); //取消休眠模式
wakeLock.release(); //釋放不休眠狀態
<uses-permission android:name="android.permission.WAKE_LOCK"/>
沒有留言:
張貼留言