android - 无法隐藏 ActionBar (Android)

标签 android android-actionbar

我试图在 SplashScreenActivity 中隐藏 ActionBar,但我无法隐藏。它总是显示。

我试过了:但没用

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_splash);

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
        getActionBar().hide();
        setContentView(R.layout.activity_splash);

这不幸地停止了应用

    <application
            android:name="info.androidhive.awesomewallpapers.app.AppController"
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/FreeWallTheme">
            <activity
                android:name="info.androidhive.awesomewallpapers.SplashActivity"
                android:label="@string/app_name"
                android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>

最佳答案

在您应用程序的 list 文件中,在 <application> 中设置以下属性标签。

android:theme="@android:style/Theme.NoTitleBar.Fullscreen

关于android - 无法隐藏 ActionBar (Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27919167/

相关文章:

android - 何时调用 glMatrixMode()

android - 在滚动事件期间更改操作栏 alpha

android - 更改单个 Top Activity 的主题

android - 带有半透明状态栏的叠加操作栏

android - 清除 fragment 中的操作栏

java - Android:如何在某些 Activity 上隐藏 ActionBar

android - 恢复 Top Activity 而不是启动 Launcher Activity

java - 尽快在 Gradle 中测试子模块(无需配置其余项目)

android - 在我的广播接收器的 onreceive() 方法中,如何判断 Intent 的来源

android - 在每个滑动 fragment 中使用不同的操作栏项目滑动 View