android編程開發(fā)之全屏和退出全屏的實(shí)現(xiàn)方法
本文實(shí)例講述了android編程開發(fā)之全屏和退出全屏的實(shí)現(xiàn)方法。分享給大家供大家參考,具體如下:
xml代碼:
<Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/fullscreen" android:onClick="changescreen"/>
java代碼:
private static boolean isfull=true; //全屏設(shè)置和退出全屏 private void setFullScreen(){ //requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); isfull=true; } private void quitFullScreen(){ final WindowManager.LayoutParams attrs = getWindow().getAttributes(); attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setAttributes(attrs); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); //requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); isfull=false; } public void changescreen(View view) { if(isfull==true) { quitFullScreen(); } else { setFullScreen(); } }
附加:開始設(shè)置無title,全屏
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // remove title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); // full screen this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main); }
希望本文所述對大家Android程序設(shè)計有所幫助。
- Android編程實(shí)現(xiàn)WebView自適應(yīng)全屏方法小結(jié)
- Android編程設(shè)置全屏的方法實(shí)例詳解
- Android編程實(shí)現(xiàn)WebView全屏播放的方法(附源碼)
- Android中3種全屏方法及3種去掉標(biāo)題欄的方法
- Android設(shè)置全屏代碼分享
- Android下Activity全屏顯示實(shí)現(xiàn)方法
- android 設(shè)置全屏的兩種方法
- android屏幕全屏的實(shí)現(xiàn)代碼
- Android 設(shè)置應(yīng)用全屏的兩種解決方法
- android全屏去掉title欄的多種實(shí)現(xiàn)方法
- Android編程之界面實(shí)現(xiàn)全屏顯示的方法(2種方法)
相關(guān)文章
詳解Android數(shù)據(jù)存儲之SQLCipher數(shù)據(jù)庫加密
對于已經(jīng)ROOT的手機(jī)來說的沒有任何安全性可以,一旦被利用將會導(dǎo)致數(shù)據(jù)庫數(shù)據(jù)的泄漏,本篇文章主要介紹了Android數(shù)據(jù)存儲之SQLCipher數(shù)據(jù)庫加密,具有一定的參考價值,有需要的可以了解一下。2016-12-12Flutter實(shí)現(xiàn)PopupMenu彈出式菜單按鈕詳解
這篇文章主要介紹了Flutter實(shí)現(xiàn)PopupMenu彈出式菜單按鈕,PopupMenuButton是一個用于創(chuàng)建彈出菜單的小部件,當(dāng)用戶點(diǎn)擊觸發(fā)按鈕時,PopupMenuButton會在屏幕上方或下方彈出一個菜單,感興趣想要詳細(xì)了解可以參考下文2023-05-05Android使用RecyclerView實(shí)現(xiàn)水平滾動控件
這篇文章給大家介紹了利用Android使用RecyclerView實(shí)現(xiàn)水平滾動的效果,本文做了一個年齡滾動控件的例子,對大家開發(fā)Android具有一定參考借鑒價值,有需要的可以參考借鑒。2016-09-09android開發(fā)實(shí)踐之ndk編譯命令簡單示例
這篇文章主要給大家介紹了在android中ndk編譯命令使用的相關(guān)資料,文中詳細(xì)介紹了ndk-build命令行參數(shù),并通過簡單的示例代碼給大家介紹了如何編寫 .c 文件,需要的朋友可以參考借鑒,下面來一起看看吧。2017-06-06Jetpack?Compose重寫TopAppBar實(shí)現(xiàn)標(biāo)題多行折疊詳解
這篇文章主要為大家介紹了Jetpack?Compose重寫TopAppBar實(shí)現(xiàn)標(biāo)題多行折疊示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-11-11Android系統(tǒng)的五種數(shù)據(jù)存儲形式實(shí)例(一)
Android系統(tǒng)有五種數(shù)據(jù)存儲形式,分別是文件存儲、SP存儲、數(shù)據(jù)庫存儲、contentprovider 內(nèi)容提供者、網(wǎng)絡(luò)存儲。本篇文章詳解的介紹了每種數(shù)據(jù)存儲的用法,有興趣的可以了解一下。2016-12-12