简体   繁体   English

在Android中显示图片的最佳方法是哪种?

[英]Which is the best way to display images in Android?

so im developing an app that shows a lot of images to the user. 因此,即时通讯开发了一个向用户显示大量图像的应用程序。 The problem im facing is that currently for the prototype,ive stored my images in the drawable folder. 面临的问题是,当前对于原型,我将图像存储在drawable文件夹中。 But this seems to slow the app down loading images and usually gives a OutofMemory error. 但这似乎减慢了应用程序加载图像的速度,并且通常会出现OutofMemory错误。 so after some searching iv figured out that i can 所以经过一些搜索iv想出了我可以

1) Load them from a sqlite Databse or 1)从sqlite数据库加载它们或

2) download them from a server/cloud on the first run of the app and use them from a particular directory 2)在应用首次运行时从服务器/云下载它们,并从特定目录使用它们

which one of these would be the most appropriate and efficient as il be using images that are mostly above 1MB? 如果不使用大多数1MB以上的图像,哪一个是最合适和最有效的呢?

25 images of about 1MB are not a big amount of data for an APP. 25张约1MB的图像对于一个APP来说不是大量数据。

The problem here is the weight of every individual image. 这里的问题是每张图像的重量。 In your case, I recommend you to store them in a SQLite database because what makes your phone slow is dealing with every single image, the time to load them. 对于您的情况,我建议您将它们存储在SQLite数据库中,因为导致手机变慢的原因是处理每个单个图像以及加载它们的时间。

If you store them in a server you will have to add your load time to your download time... 如果将它们存储在服务器中,则必须将加载时间添加到下载时间中...

Dummy advise: make them smaller xD 虚拟建议:使它们缩小xD

I hope this would help you ;) 希望对您有帮助;)

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

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