如何显示在加载活动启动图像图像、加载

2023-09-06 13:49:52 作者:低吟ぃ浅唱

我有一个包含许多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()

 
精彩推荐