ViewPager unable to load images lazily with Picasso

故事扮演 提交于 2019-12-01 14:05:21

Your first approach should work fine... if you implement it correctly. I would expect your code to crash with a NullPointerException.

Replace:

ImageView imageView = (ImageView)getView().findViewById(R.id.fragment_image);

with:

ImageView imageView = (ImageView)myFragmentView.findViewById(R.id.fragment_image);

Your lazy loader should work in the context of the

Fragment.createView()

where the Fragment is one of a collection being paged by the ViewPager and the FragmentpagerAdapter

That is your option one.

I use another lazyloader that manages local memcache and local filesys cache for the bitmaps needed to load the images. at the time of the "OnCreateView()" it will go to the network to get the URL for the loader if the bitmap is not already cached.

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