2012-03-05 165 views
13

如何刪除Android應用中默認的頂部標題欄?刪除默認標題欄

enter image description here

灰色你好,Android的吧?

+1

你想要什麼怎麼辦?只要將其刪除並且沒有標題欄或將其替換爲您自己的自定義標題欄?你是否至少嘗試了谷歌搜索,因爲我只是搜索了你的頭銜,這給了我一堆好的結果.. – 2012-03-05 03:15:55

+0

這可能是http://stackoverflow.com/questions/2446373/android-title-bar-removal和潛在的重複http://stackoverflow.com/questions/2445999/what-do-i-have-to- add-to-a-layout-to-hide-the-titlebar/2446087 – 2012-03-05 03:17:39

+0

謝謝,由於某種原因我沒有馬上找到任何東西。我想我寧願使用自定義標題欄,而不是刪除它。 – Brianjs 2012-03-05 03:22:06

回答

30

它非常簡單,只是去掉標題欄,android的地址:主題屬性到AndroidManifest.xml

<application android:theme="@android:style/Theme.NoTitleBar"> 
+1

'應用程序android:icon =「@ drawable/icon」android:screenOrientation =「portrait」android:theme =「@ style/MyTheme」android:theme =「@ android:style/Theme。 NoTitleBar「>」拋出和錯誤。我假設,因爲我無法訪問主題兩次?有沒有解決方法? MyTheme.NoTitleBar不起作用 – Brianjs 2012-03-05 04:19:30

+0

你的設備中是否安裝了該主題? – Android 2012-03-05 04:20:46

+0

我的主題或主題? Mytheme鏈接到新的背景圖片 – Brianjs 2012-03-05 04:22:14

22
<style name="MyTheme" parent="@android:style/Theme.NoTitleBar"> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:windowBackground">@drawable/xyz</item> 
</style> 
+0

這是我的結局problem.Thank你的解決方案!但是,這不是我的原始問題,所以我不能爲其他人標記解決方案。 – Brianjs 2012-03-05 15:31:25

+0

就是這樣......結合你的主題與本地......感謝 – luigi7up 2013-05-30 10:30:57

5

enter image description here

走進清單文件

點擊底部的「應用程序」標籤(如圖所示)

En之三@android:style/Theme.NoTitleBar(如圖所示)

3

試試這個:

requestWindowFeature(Window.FEATURE_NO_TITLE); 
0
android:theme="@android:style/Theme.NoTitleBar" 

內的AndroidManifest.xml我添加的代碼=)

2

爲了做到這一點,我宣佈一個風格繼承一切從我的大將風範。這種風格禁用默認的Android titleBar。

<style name="generalnotitle" parent="general"> 
    <item name="android:windowNoTitle">true</item> 
</style> 

創建一個新的風格和你的不同視圖這種風格或默認樣式添加以下代碼以禁用標題欄的所有窗口!

0

還有幾個主題可用沒有標題欄。對於例如Theme.AppCompat.Light.NoActionBar適用不標題欄中的各自主題

0

對於Android Studio中2.2.2,2016

替換app/src/main/res/values/styles.xmlTheme.AppCompat.Light.DarkActionBarTheme.AppCompat.NoActionBar

實施例:

<resources> 
    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> 
     <!-- Customize your theme here. --> 
    </style> 
</resources> 
0

發生此問題當您使用默認的內置工具欄和您自己的自定義工具欄時。有兩種方法。

1)導航至價值/ style.xml < ---基地應用主題樣式TO->和改變你的父主題等:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 
  • 的另一種方法是主題屬性添加到您的活動的清單文件:

    機器人:主題=「@風格/ Theme.AppCompat.Light.NoActionBar」