Android實(shí)現(xiàn)固定屏幕顯示的方法
本文實(shí)例講述了Android實(shí)現(xiàn)固定屏幕顯示的方法。分享給大家供大家參考。具體如下:
在Android開(kāi)發(fā)中我們會(huì)碰到開(kāi)發(fā)屏幕扭轉(zhuǎn)的情況,如何固定住屏幕ScreenOrientation 呢?
在學(xué)習(xí)jetboy代碼時(shí),發(fā)現(xiàn)屏幕被旋轉(zhuǎn)了,代查代碼沒(méi)有找到相關(guān)設(shè)置,在manifest.xml中找到了相關(guān)的代碼:
找到這名代碼:
portrait表示橫向,landscape表示縱向
如果要使Activity的View界面全屏,只需要將最上面的信號(hào)欄和Activity的Title欄隱藏掉即可,隱藏Title欄的代碼:
配置文件里代碼:
隱藏信號(hào)欄的代碼:
其它使用:
至此Android開(kāi)發(fā)中的屏幕固定問(wèn)題就解決了!
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.jetboy" android:versionCode="1" android:versionName="1.0.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name=".JetBoy" android:label="@string/app_name" android:screenOrientation="portrait" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="4"></uses-sdk> <!-- <uses-library android:name="android.test.runner" /> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.example.android.jetboy" android:functionalTest="true" android:label="Jetboy Test All Runner"/> <uses-permission android:name="android.permission.RUN_INSTRUMENTATION"/> --> </manifest> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.jetboy" android:versionCode="1" android:versionName="1.0.0"> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar"> <activity android:name=".JetBoy" android:label="@string/app_name" android:screenOrientation="portrait" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="4"></uses-sdk> <!-- <uses-library android:name="android.test.runner" /> <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.example.android.jetboy" android:functionalTest="true" android:label="Jetboy Test All Runner"/> <uses-permission android:name="android.permission.RUN_INSTRUMENTATION"/> --> </manifest>
希望本文所述對(duì)大家的Android程序設(shè)計(jì)有所幫助。
- Android側(cè)滑導(dǎo)航欄的實(shí)例代碼
- Android編程使用自定義View實(shí)現(xiàn)水波進(jìn)度效果示例
- Android編程實(shí)現(xiàn)點(diǎn)擊鏈接打開(kāi)APP功能示例
- Android編程使用android-support-design實(shí)現(xiàn)MD風(fēng)格對(duì)話框功能示例
- Android編程實(shí)現(xiàn)的簡(jiǎn)易路徑導(dǎo)航條功能示例
- Android編程實(shí)現(xiàn)ActionBar的home圖標(biāo)動(dòng)畫切換效果
- Android 屏幕切換監(jiān)聽(tīng)的實(shí)例代碼
- Android SQLite數(shù)據(jù)庫(kù)中的表詳解
- Android實(shí)現(xiàn)第三方登錄的上拉展開(kāi),下拉隱藏,下拉隱藏示例
- 詳解Android應(yīng)用開(kāi)發(fā)--MP3音樂(lè)播放器代碼實(shí)現(xiàn)(一)
- Android6.0 固定屏幕功能實(shí)現(xiàn)方法及實(shí)例
相關(guān)文章
Flutter實(shí)現(xiàn)視頻壓縮功能的示例代碼
移動(dòng)應(yīng)用程序中,視頻占用了大量的存儲(chǔ)空間和帶寬,這在一定程度上影響了應(yīng)用程序的性能和用戶體驗(yàn),所以本文為大家準(zhǔn)備了Flutter實(shí)現(xiàn)視頻壓縮的方法,需要的可以參考一下2023-06-06Android編程實(shí)現(xiàn)自定義進(jìn)度條顏色的方法
這篇文章主要介紹了Android編程實(shí)現(xiàn)自定義進(jìn)度條顏色的方法,涉及Android進(jìn)度條的樣式布局及功能實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11詳解Android中常見(jiàn)的內(nèi)存優(yōu)化及內(nèi)存泄露場(chǎng)景
本文主要給大家介紹了Android中常見(jiàn)的內(nèi)存優(yōu)化及Android開(kāi)發(fā)中容易造成內(nèi)存泄露的場(chǎng)景,對(duì)我們的學(xué)習(xí)或工作有一定的幫助,需要的朋友可以參考下2023-08-08淺談Android設(shè)計(jì)模式學(xué)習(xí)之觀察者模式
觀察者模式在實(shí)際項(xiàng)目中使用的也是非常頻繁的,它最常用的地方是GUI系統(tǒng)、訂閱——發(fā)布系統(tǒng)等。這篇文章主要介紹了淺談Android設(shè)計(jì)模式學(xué)習(xí)之觀察者模式,感興趣的小伙伴們可以參考一下2018-05-05Android編程設(shè)計(jì)模式之Builder模式實(shí)例詳解
這篇文章主要介紹了Android編程設(shè)計(jì)模式之Builder模式,結(jié)合實(shí)例形式詳細(xì)分析了Android設(shè)計(jì)模式之Builder模式概念、功能、使用場(chǎng)景、用法及相關(guān)注意事項(xiàng),需要的朋友可以參考下2017-12-12非常實(shí)用的小功能 Android應(yīng)用版本的更新實(shí)例
這篇文章主要為大家詳細(xì)介紹了一個(gè)非常實(shí)用的小功能,Android應(yīng)用版本的更新實(shí)例,感興趣的小伙伴們可以參考一下2016-08-08android自定義Toast設(shè)定顯示時(shí)間
這篇文章主要為大家詳細(xì)介紹了android自定義Toast設(shè)定顯示時(shí)間,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-08-08