PhotoView icon indicating copy to clipboard operation
PhotoView copied to clipboard

我想问问下我用Glide加载图片 在listview中点击放大的时候第一次进去位置不对

Open njgghhe opened this issue 9 years ago • 7 comments

我就是好用Demo里面那个GridView的例子,就是把GridView换成了listview 加载图片的话用Glide,第一次点进去位置会乱跑到左下角,然后点击再次进去就是显示正中央 是正常的 我就放了四个图片,每一个图片进去位置都不一样,第二次就会正常显示在中央,然后退界面后再次进来就又会出现这个情况,请问这是应该怎么解决

njgghhe avatar Apr 26 '17 03:04 njgghhe

你用了Glide,因为是网络加载,开始是没有缓存,导致位置偏差,下次进去缓存了,所以正常了,我给你一个解决的方法把,希望以后有人看到可以这么做: Glide.with(BaseApplication.mContext) .load(url) .placeholder(R.color.gray) .error(R.color.gray) .into(new SimpleTarget<GlideDrawable>() { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) { //在这里做处理 if (dialog != null)dialog.dismiss(); mPhotoView.setImageDrawable(resource); mBg.startAnimation(in); mBg.setVisibility(View.VISIBLE); mParent.setVisibility(View.VISIBLE); mPhotoView.animaFrom(mInfo); } });

lodgkk avatar Apr 29 '17 12:04 lodgkk

好的 谢谢谢谢 请问 if (dialog != null)dialog.dismiss();这一句 我原本里面是没有的 这是是根据什么来判断的

njgghhe avatar May 02 '17 06:05 njgghhe

dialog这句可以忽略,他应该想表达的是into(new SimpleTarget() {public void onResourceReady(}

bm-x avatar May 02 '17 07:05 bm-x

哦哦 这样啊 我在试试 有结果就发出来

njgghhe avatar May 02 '17 07:05 njgghhe

好了 这样是可以的 谢谢 非常感谢!!

njgghhe avatar May 02 '17 07:05 njgghhe

正好解决了我的问题

loryrichie avatar Nov 09 '17 02:11 loryrichie

确实可以用,非常感谢

xvvx-Rainbowcat avatar Nov 27 '18 06:11 xvvx-Rainbowcat