How to make a splash screen efficiently

半腔热情 提交于 2020-01-07 01:11:10

问题


I am trying to make splash screen for my app so that I can load some data in when I am showing the splash screen .But seems there are many way of making a splash screen.

1.Make a new activity with a layout and show that activity for some time.But making another activity with a layout makes the app heavy.

2.Make a new activity with no layout and making a splash screen back ground instead as shown here

3.Make a fragment with a layout and show them as splash screen as shown here

Among all these which is the best way of making a splash screen. I am able to make a splash screen but I want to make it light and easy.


回答1:


1.Make a new activity with a layout and show that activity for some time.But making another activity with a layout makes the app heavy.

While making the activity, you use Thread to show the splash screen. Make the Activity thread sleep for few seconds and update background data during sleep is efficient.




回答2:


As much as possible avoid having a splash in your app. As an app user I also have this behavior.

  • I really need to use the App immediately because time is precious.
  • I have limited patience (probably most people will agree).
  • I don't need it at all.

So what if we can't totally avoid having a splash screen? The suggested concept that I gather are these:

  • Lazy Loading - Load only those piece of information that is really needed by now. Example : A Movie app: Load only those latest movies rather than those old movies unless the user told you to do so. The idea here is that decided only on which is necessary to load first and load other else later on. With this approached you lessen the time showing your splash screen.

  • Caching - If you keep on downloading things from your server chances are it might take too long to load and your splash screen will be visible for longer period of time. With caching you will need to fetch fewer data from the network since you've downloaded some of them already.

Things to consider in creating views.

  • Avoid a super deep nested views.
  • Avoid a deep nested weights.
  • For image loading use some popular library like Picasso, Glide etc.


来源:https://stackoverflow.com/questions/39332403/how-to-make-a-splash-screen-efficiently

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!