Android Studio中如何隱藏頂部狀態列和標題欄
阿新 • • 發佈:2019-02-13
Android Studio如何實現隱藏標題欄和狀態列:
一、在values的styles.xml檔案中新增子標籤,如下:
<style name="NoTitle" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
二、在清單檔案AndroidManifest.xml中,做如下引用
android:theme="@style/NoTitle"
修改後的AndroidManifest.xml檔案如下
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.datay.gametest"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/NoTitle"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
經過以上兩步操作,標題欄和狀態列便完美隱藏了!