android開發(fā)去除標題欄的方法
1:新建一個項目運行起來,可以看到頂部一直有個標題欄看著不是很美觀

2:有兩種方法可以去除頂部標題欄
(1)將代碼中AndroidManifest里android:theme="@style/Theme.MyApplication"改為android:theme="@style/Theme.AppCompat.NoActionBar">
<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/Theme.AppCompat.NoActionBar"
>
(2)在themes.xml文件里改,選中MyApplication,Ctrl+鼠標點擊

來到themes.xml文件里,把代碼中parent="Theme.MaterialComponents.DayNight.DarkActionBar"替換為
parent=“Theme.AppCompat.Light.NoActionBar”
<style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
3:效果展示

到此這篇關于android開發(fā)去除標題欄的文章就介紹到這了,更多相關android去除標題欄內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
android中DatePicker和TimePicker的使用方法詳解
這篇文章主要介紹了android中DatePicker和TimePicker的使用方法,是Android中常用的功能,需要的朋友可以參考下2014-07-07
Android EditText實現(xiàn)輸入金額類型詳解
EditText是Android中一個非常實用的控件,有很多InputType,可以來達到不同的輸入效果,下面這篇文章主要給大家介紹了關于Android EditText實現(xiàn)輸入金額類型的相關資料,需要的朋友可以參考借鑒,下面來一起看看吧。2017-09-09
Android自定義TimeButton實現(xiàn)倒計時按鈕
這篇文章主要為大家詳細介紹了Android自定義TimeButton實現(xiàn)倒計時按鈕,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-12-12
Android ImageButton自定義按鈕的按下效果的代碼實現(xiàn)方法分享
這篇文章主要介紹了Android ImageButton自定義按鈕的按下效果的代碼實現(xiàn)方法,需要的朋友可以參考下2014-02-02
Android實現(xiàn)動態(tài)高斯模糊背景效果
在現(xiàn)代 Android UI 中,動態(tài)高斯模糊背景 常見于對話框或彈窗后面的模糊遮罩,相比靜態(tài)模糊圖,動態(tài)模糊可隨著內(nèi)容滾動或變化實時更新,使界面更具層次感與沉浸感,所以本文給大家介紹了Android實現(xiàn)動態(tài)高斯模糊背景效果,需要的朋友可以參考下2025-04-04
使用androidx BiometricPrompt實現(xiàn)指紋驗證功能
這篇文章主要介紹了使用androidx BiometricPrompt實現(xiàn)指紋驗證功能,對android指紋驗證相關知識感興趣的朋友跟隨小編一起看看吧2021-07-07
Android 開發(fā)系統(tǒng)自帶語音模塊應用
本篇文章 主要介紹 Android 開發(fā)自帶語音模塊實例,在開發(fā)Android系統(tǒng)中會用到系統(tǒng)語音搜索模塊,這里給大家一個參考實例2016-07-07

