本文介绍了如何显示在加载活动启动图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含许多UI意见的活动。在其onCreate方法,我发现的setContentView单线需要8-12秒内完成。所以,我想告诉我的标志形象,同时它的加载。我尝试了很多东西,但没有成功。我怀疑主要的原因可能是整理的setContentView之前,没有什么可以证明。

I have an activity that contains many UI views. In its onCreate method, I found single line of setContentView takes 8-12 seconds to be complete. So I want to show my logo image while it's loading. I tried many things but without any success. I suspect main reason might be that before finishing setContentView, nothing can be shown.

任何帮助将是AP preciated。

Any help would be appreciated.

更新:

我想很多人不知道,你不能表现出整理的setContentView之前的任何对话。因此,使用另一种防溅活动不帮我。

I think many people do not know that you cannot show any dialog before finishing setContentView. So using another splash activity does not help me at all.

UPDATE2

我忘了后,我发现这个问题的原因来更新这个问题。请参考以下问题:的setContentView服用很长一段时间(10-15秒)来执行

I forgot to update this question after I found cause of the problem. Please refer to following question: setContentView taking long time (10-15 seconds) to execute

推荐答案

使用的AsyncTask

把溅在在preExecute()

和做你的工作doInBackground()

和密切飞溅 onPostExecute()

这篇关于如何显示在加载活动启动图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 13:26