0

所以我有 6 类图片,每个类别有 150-200 张图片。每张图片的大小为1MB-10MB。我不确定如何优化图片的加载。我的 ViewPager 同时显示 1 个类别中的 4 张图片,该类别被选中,并且可以滑动浏览该类别的所有图片。有人能引导我走向正确的方向吗?我是 android/programming 的新手,我发现的一切都很复杂。

谢谢。

编辑:我还有一部 270MB 的电影,我不确定如何加载,所以感觉“很快”。

4

2 回答 2

3

我已经无数次使用这个库,如果用户稍后返回视图,它会自动缓存图像。

通用图像加载器

于 2014-10-01T07:33:24.283 回答
0

First of all, use FragmentStatePagerAdapter for your ViewPager. It will prevent OutOfMemory errors due to the large number of images.

http://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html

Second, use Picasso for your image loading, and consider resizing your images down, because you probably don't need full resolution for them to look nice.

https://github.com/square/picasso

And third, if you can let user to choose his favourite video player from the list of installed apps, you should do so.

Android intent for playing video?

于 2014-10-01T07:30:42.290 回答