简体   繁体   English

如何提高android多屏应用的性能

[英]how to improve performance of android multiple screens app

how to improve performance of android multiple screens app.Do I use activities for controllers and fragments for views likewise or is there any other structure i could use. 如何提高android多屏app的性能。我是否同样使用控制器的活动和视图的片段,或者是否可以使用其他结构? I learned that nested layouts could slow down your app and not closing Handlers also leaks memory. 我了解到,嵌套布局可能会降低您的应用程序的速度,并且不关闭处理程序也会泄漏内存。

You should check your requirement and according to that you should use component as well as layouts for application. 您应该检查您的要求,并据此使用组件以及应用程序布局。

Let's see some possible ways for improve performance: 让我们看一些提高性能的可能方法:

  • When you are working with images, try to release all views when not in use. 使用图像时,请尝试在不使用时释放所有视图。

  • If your screens are dependent then try to work with drawer and fragments to load quickly. 如果您的屏幕是从属屏幕,请尝试使用抽屉和片段快速加载。

  • When ever you are working with database or network, never run such task on main thread use async task for same to improve performance. 无论何时使用数据库或网络,都不要在主线程上运行此类任务,而应使用异步任务来提高性能。

  • When you are using list or recycle view for list data, never directly load images inside, use lazy loading to improve performance. 当使用列表视图或列表视图的回收视图时,切勿直接在其中加载图像,请使用延迟加载来提高性能。
    • Use local cache to store temporary data to improve performance. 使用本地缓存存储临时数据以提高性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM