启动Android应用程序图标显示不当行为或延迟?

时间:2014-06-26 15:42:27

标签: android

在我的应用程序中显示启动画面时,我正面临0.3毫秒的延迟。 当它启动带有顶部标题的黑色屏幕时,左侧显示app图标,如0.3或0.2毫秒,则启动画面显示[启动器活动]。我将此Splash活动设置为启动器活动并显示5秒钟,并且在代码中没有手动设置延迟。如果应用程序很重或者我在编码时遗漏了某些东西,它可能会发生。请帮助。

代码:

public class SplashScreen extends Activity {

    // Splash screen timer
    private static int SPLASH_TIME_OUT = 5000;

    @Override
    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.splashscreen);

        new Handler().postDelayed(new Runnable() {

            /*
             * Showing splash screen with a timer. 
             */

            @Override
            public void run() {
                // This method will be executed once the timer is over

                Intent i = new Intent(SplashScreen.this, TabBar.class);
                startActivity(i);

                // close this activity
                finish();
            }
        }, SPLASH_TIME_OUT);
    }

}

3 个答案:

答案 0 :(得分:0)

在您的清单中更改您的启动活动主题

@android:风格/ Theme.Light.NoTitleBar.Fullscreen

或@android:style / Theme.Light.NoTitleBar

取决于您的要求

答案 1 :(得分:0)

我认为您需要更改或自定义清单文件中的应用主题:您可以在以下位置找到它:

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" > 

答案 2 :(得分:0)

由于API级别限制,我无法更改主题,我确实找到了答案: 在值/样式

<style name="AppTheme" parent="AppBaseTheme">

        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style>

看起来它实际上是标题栏。 虽然出现了另一个问题:出现白色飞溅然后我的飞溅图像0.2到0.3毫秒现在该怎么办? 有什么建议??

相关问题