安卓Splashscreen-动作栏来了一会儿就消失了



在我正在开发的应用程序中,我正在实现一个splashscreen。当启动防溅屏时,action bar会出现一小段时间,比如半秒钟,然后消失。我不知道为什么会发生这种事。有谁能帮我解决这个问题吗。我已经在manifest file中实现了以下代码。

<activity
        android:name="com.example.trycatch.SplashscreenActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:noHistory = "true"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>
    </activity>

下面是活动文件片段

@Override
protected void onResume() {
        setContentView(R.layout.splashscreen);
    super.onResume();
}

有人能帮我吗?谢谢你抽出时间。

PS:我正在使用sherlock actionbar

在setContentView()之前,在活动中使用以下代码(即在java文件中)

    requestWindowFeature(Window.FEATURE_NO_TITLE);

将其添加到android清单文件中

<activity
            android:name="com.example.abc.SplashScreen"
            android:label="@string/app_name"
            android:theme="@style/Theme.Sherlock.NoActionBar" ></activity>

使用以下代码消失操作栏:

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

更多信息

最新更新