如何当Intent.FLAG_ACTIVITY_NEW_TASK避免黑屏| Intent.FLAG_ACTIVITY_CLEAR_TASK设置? [英] How to avoid black screen when Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK is set?

查看:1208
本文介绍了如何当Intent.FLAG_ACTIVITY_NEW_TASK避免黑屏| Intent.FLAG_ACTIVITY_CLEAR_TASK设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我需要使用 Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK 来设置我的意图的标志。我可以删除我所有的previous 活动,并开始一个新的活动在这个way.This是我的code如下:

In my android app, I need to use Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK to set my intent flag. I can remove all my previous Activities and start a new Activity in this way.This is my code below:

Intent intent = new Intent(Gerenxinxi.this, MainPart.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
overridePendingTransition(0,0);

不过,我发现黑屏闪烁,当我使用code以上。如果我没有设置标志的意图与 Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK ,黑屏闪烁会gone.My的问题是:我能做些什么来避免黑屏时 Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK 设置?

However,I found a flicker of black screen when i use the code above. If I don't set intent flag with Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK , the flicker of black screen will be gone.My question is: what can I do to avoid the black screen when Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK is set ?

在我写下这个问题,我发现有人有类似question.This是<一个href=\"http://stackoverflow.com/questions/29015885/how-to-avoid-black-screen-on-startactivity-when-flag-activity-clear-task-is-set\">link然而,这个问题的答案也解决不了我的problem.So我问的问题again.I希望有人可以帮助你me.Thank。

Before I write down this question, I have found that someone has the similar question.This is the link However,the answers of this question can not solve my problem.So I ask the question again.I hope anyone can help me.Thank you.

推荐答案

这是你看到的是所谓的preVIEW屏幕此初始屏幕。您可以通过在你的主题声明这个彻底禁用:

This initial screen that you see is called the "Preview" screen. You can disable this completely by declaring this in your theme:

android:windowDisablePreview

<style name="Theme.MyTheme" parent="android:style/Theme.Holo">
    <!-- This disables the black preview screen -->
    <item name="android:windowDisablePreview">true</item>
</style>

这篇关于如何当Intent.FLAG_ACTIVITY_NEW_TASK避免黑屏| Intent.FLAG_ACTIVITY_CLEAR_TASK设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆