2015-11-06 176 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