android - 如何从操作栏 Sherlock 中删除 Activity 标题而不从 'RecentApps' 选择器中丢失它?

标签 android actionbarsherlock

我在尝试从我的 Action Bar Sherlock 中删除 Activity 标题文本时遇到问题。 我花了(浪费)了很多时间来寻找解决方案,但就是无法解决这个问题。

我有一个全屏显示的 Splash Activity。但就在 Splash Activity 出现之前,出现了一个屏幕(持续很短的时间),其中只有一个带有 App IconActivity 的操作栏标题 文本。我不明白为什么会出现。这是默认的 Android 行为吗?我想避开这个屏幕,或者至少从这个屏幕上的操作栏中删除 Activity 标题。如果我将它设置为“”,我会从最近的应用程序选择器中丢失该应用程序。

请引用这些图片:

预飞溅:

启动画面:

我在 SO 上引用了以下示例,并在其他地方进行了搜索。但似乎没有任何效果。

Remove the title text from the action bar in one single activity

Action Bar remove title and reclaim space

How do you remove the title text from the Android ActionBar?

How can I remove title and icon completetly in Actionbar sherlock?

请检查我的 Android Manifest 和主题文件...

<application
    android:name="com.zipcash.zipcashbetaversion.MyApplication"
    android:allowBackup="true"
    android:icon="@drawable/zipcash_icon"
    android:label="@string/app_name"
    android:logo="@drawable/zipcash_logo_small"
    android:theme="@style/Theme.MyTheme" >
    <activity
        android:name="com.zipcash.zipcashbetaversion.SplashActivity"
        android:label="@string/app_name" 
        android:screenOrientation="portrait" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.zipcash.zipcashbetaversion.SignUpActivity"
        android:label="@string/title_activity_sign_up"  
        android:screenOrientation="portrait" >
    </activity>

等等... 以下是我的主题文件:

<style name="Theme.MyTheme" parent="Theme.Sherlock.Light">

    <!-- Set style for Action Bar (affects tab bar too) -->
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">

    <!-- define background for action bar (sets default for all parts of action bar - main, stacked, split) -->
    <item name="android:background">@drawable/background</item>
    <item name="background">@drawable/background</item>

    <!-- set background for the tab bar (stacked action bar) - it overrides the background property -->
    <item name="backgroundStacked">@color/action_bar_tab_background</item>
    <item name="titleTextStyle">@style/NoTitleText</item>
    <item name="subtitleTextStyle">@style/NoTitleText</item>
    <item name="displayOptions">showHome|useLogo</item>
</style>

<style name="NoTitleText">
    <item name="android:textSize">0sp</item>
    <item name="android:textColor">#00000000</item>
    <item name="android:visibility">invisible</item>
</style>

我也在我的 Splash Activity 中编写了这段代码:

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(actionBar.getDisplayOptions() ^ ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.hide();

    ActivityHelper.initialize(this);

    setContentView(R.layout.activity_splash);

我是否犯了一个我忽略的错误。还有什么我应该做的吗?我的最低 API 级别是 8。

我们将不胜感激。

最佳答案

您可以将此添加到您的 Activity 中:

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

关于android - 如何从操作栏 Sherlock 中删除 Activity 标题而不从 'RecentApps' 选择器中丢失它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23469730/

相关文章:

java - Android Studio 在 Windows 7 64 位上运行失败

在在线和离线模式下工作的 Android 应用程序?

android - 带有选定列表项指示器的双 Pane View

android - 如何使用 actionbarsherlock 更改操作栏的颜色

android - ActionBarSherlock + 拆分操作栏菜单 + 带有 "withText"的项目不显示文本。怎么修?

android - 如何仅浏览我的应用程序中的文本文件

android - 如何调试导致 ChromeOS 上的插件崩溃的 Android 应用

android - ActionBar setBackgroundDrawable() 从线程/处理程序中取消背景

android - ActionBarSherlock 4.2 的构建问题

android - 搜索 View 使用应用程序图标而不是 Logo