我想从我的应用程序中删除标题栏但是当我使用Theme.Light.NoTitleBar时它会在样式xml文件中显示错误 这是我的样式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="Theme.AppCompat.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>
</resources>
这是我的清单文件
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
答案 0 :(得分:0)
首先使用所有活动
requestWindowFeature(Window.FEATURE_NO_TITLE);
在标签栏正下方的工具栏上,有一排图标。点击看起来像星星的那个,然后转到All - &gt; Theme.NoTitleBar(.Fullscreen)
答案 1 :(得分:0)
试试这个:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
</style>
答案 2 :(得分:0)
试试这个
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Remove title bar
setContentView(R.layout.activity_home);
注意:必须在setContentView(layout_id)之前调用删除标题栏,通知栏等功能;
答案 3 :(得分:0)
编程
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_home);
从清单文件
<activity
android:name="<YOUR_PACKAGENAME.ACTIVITY>"
android:theme="@android:style/Theme.Black.NoTitleBar" >
你完成了:)
答案 4 :(得分:0)
//add to AndroidManifest for SplashScreen
<activity
android:name="<YOUR_PACKAGENAME.ACTIVITY>"
android:theme="@style/AppTheme.NoActionBar"
.........../>
//add this styles to styles.xml
<style name="AppTheme.NoActionBar">
<item name="android:background">@android:color/transparent</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
//add this code to Activity
public class SplashScreen extends AppCompatActivity {
.
.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
.
.
.
}
}