2015年7月16日 星期四

[擒猿筆記篇] Android切換全螢幕與非全螢幕的方法

找了好幾個方法終於有一個能用的,特此紀錄一下。

切換為全螢幕
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

切回非全螢幕
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

以上是把 status bar 和 navigation bar 隱藏,如果連 title bar 都不要就要在 xml 檔中設置:
<item name="android:windowNoTitle">true</item>

或是在 onCreate() 中加入:
requestWindowFeature(Window.FEATURE_NO_TITLE);

補個幹你娘ㄎㄎ

1 則留言:

  1. If you're attempting to lose weight then you need to start following this brand new personalized keto meal plan diet.

    To create this keto diet service, licensed nutritionists, fitness trainers, and chefs united to provide keto meal plans that are useful, convenient, money-efficient, and fun.

    Since their first launch in 2019, 100's of clients have already remodeled their figure and well-being with the benefits a certified keto meal plan diet can offer.

    Speaking of benefits; in this link, you'll discover 8 scientifically-certified ones given by the keto meal plan diet.

    回覆刪除