Android应用程序的载入画面应用程序、画面、Android

2023-09-03 22:23:53 作者:一见不钟情

我的工作,使用一个ListActivity列出了存储库的应用程序。

I'm working on an application that lists a stored library using a ListActivity.

我的问题是,当我打开应用程序它有一个明显的加载时间XML视图充气之前。在此期间,仅在应用程序名称被示出。这是明显的在相当多的应用程序在那里,但其他人似乎有实施的加载屏幕,什么不是。

My question is, is when I open application it has a visible loading time before the XML view is inflated. During this time only the application name is shown. This is noticeable on quite a few application out there but others seem to have implemented loading screens and what not.

没有任何人有一个解决的办法或不知道如何使一个很好的加载屏幕?

Does anyone have a solution to this or know how to make a good loading screen?

干杯!

推荐答案

如果你的活动正在超过一对夫妇十分之一秒启动的,你正在做的工作太多的的onCreate( ) ONSTART() onResume()。此举工作提高到一个后台线程,可能使用的AsyncTask

If your activity is taking more than a couple of tenths of a second to start up, you are doing too much work in onCreate(), onStart(), or onResume(). Move that work to a background thread, perhaps using AsyncTask.

然后,如果你想要做的事,而后台线程运算的时候,你可以使用 ProgressDialog ,或致电的setContentView()多次(最初有闪屏,然后再与完整的UI,一旦后台工作完成后),或什么的。

Then, if you want to do something while the background thread is crunching away, you can use a ProgressDialog, or call setContentView() multiple times (initially with a splash screen, then later with the full UI once the background work is done), or whatever.