2015-11-06 106 views
-1

我嘗試了所有這3種方法,但仍無法刪除標題欄。無法刪除android中的標題欄

此方法刪除在androidstudio(1.4)的標題欄,但我仍然可以看到標題欄在模擬器:

而且這兩種方法崩潰的應用程序:enter image description here

enter image description here

樣式.xml: enter image description here

編輯(如何解決):它會工作,如果你繼承而不是應用程序的活動在java文件中compat。

+0

發表您的所有文件styles.xml這裏的截圖能 –

+0

你發佈你的崩潰的堆棧跟蹤?如果您使用的是AppCompat,那麼您的應用程序主題必須從AppCompat主題繼承。 – curtisLoew

+0

愛你兄弟!它工作,如果我繼承活動,而不是appcompat.Thanks curtisLoew – hp7

回答

0
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.NoActionBar"> 
    <!-- API 11 theme customizations can go here. --> 
</style> 

在所有styles.xml文件中發佈此行。

+0

仍然無法正常工作。該應用程序崩潰。 – hp7

+0

在這裏發佈您的錯誤日誌 –

0

更改styles.xml

<style name="AppTheme" parent="android:Theme.Holo.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> 

和清單:

改變你的活動主題:

<activity 
android:theme="@styles/AppTheme 
.... 
+0

仍然無法正常工作,它崩潰的應用程序 – hp7

+0

你可以發佈你的logcat在這裏 –

0

使用自定義主題;

<style name="CustomTheme" parent="Theme.Holo.Light.NoActionBar"> 
<!-- Customize your theme here. --> 
</style> 

,並將其應用在你的清單

<application 
    android:theme="@styles/CustomTheme" 

或者直接使用它作爲:

<application 
    android:theme="Theme.Holo.Light.NoActionBar" 
0

嘗試在styles.xml把這個

<!-- 
    Base application theme, dependent on API level. This theme is replaced 
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 
--> 
<style name="AppBaseTheme" parent="android:Theme.Light"> 
    <!-- 
     Theme customizations available in newer API levels can go in 
     res/values-vXX/styles.xml, while customizations related to 
     backward-compatibility can go here. 
    --> 
</style> 

<!-- Application theme. --> 
<style name="AppTheme" parent="AppBaseTheme"> 
    <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
</style> 

和應用的主題,以您的應用程序

+0

shanu