NineGridView icon indicating copy to clipboard operation
NineGridView copied to clipboard

图片一直闪现,换成小图后好了

Open stormlei opened this issue 9 years ago • 9 comments

9张图,一直循环闪现,log显示一直在请求图片地址,换成小图后正常,是不是图片太大的缘故 @jeasonlzy

stormlei avatar Nov 29 '16 03:11 stormlei

同问,我的是三张小图一直闪烁,有时候会前两张闪烁,第三张正常,点击放大图片倒是没有

tardistao avatar Dec 01 '16 12:12 tardistao

@tardisTao @jeasonlzy 小图还是太大了吧

stormlei avatar Dec 02 '16 05:12 stormlei

@stormlei 我小图、大图用的是同一张图片

tardistao avatar Dec 02 '16 06:12 tardistao

@stormlei @tardisTao @jeasonlzy 大家最后怎么解决这个问题的

kevinluoeth avatar Dec 15 '16 03:12 kevinluoeth

@395193253 @jeasonlzy 换成小图啊,不过多大的算小,还没测试

stormlei avatar Dec 15 '16 05:12 stormlei

@stormlei 好呢!“不过多大的算小,还没测试”。换小图试下,谢谢

kevinluoeth avatar Dec 15 '16 06:12 kevinluoeth

在NineGridView中的onLayout()方法中加个 @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { if(changed){ if (mImageInfo == null) return; int childrenCount = mImageInfo.size(); for (int i = 0; i < childrenCount; i++) { ImageView childrenView = (ImageView) getChildAt(i); if (mImageLoader != null) { //改动ImageLoder mImageLoader.onDisplayImage(getContext(), childrenView, mImageInfo.get(i).thumbnailUrl,null); } int rowNum = i / columnCount; int columnNum = i % columnCount; int left = (gridWidth + gridSpacing) * columnNum + getPaddingLeft(); int top = (gridHeight + gridSpacing) * rowNum + getPaddingTop(); int right = left + gridWidth; int bottom = top + gridHeight; childrenView.layout(left, top, right, bottom); } } } 加了这个判断if(changed){}初步可以解决

hejun311 avatar Jun 27 '17 09:06 hejun311

在NineGridView中的onLayout()方法中加个 @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { if(changed){ if (mImageInfo == null) return; int childrenCount = mImageInfo.size(); for (int i = 0; i < childrenCount; i++) { ImageView childrenView = (ImageView) getChildAt(i); if (mImageLoader != null) { //改动ImageLoder mImageLoader.onDisplayImage(getContext(), childrenView, mImageInfo.get(i).thumbnailUrl,null); } int rowNum = i / columnCount; int columnNum = i % columnCount; int left = (gridWidth + gridSpacing) * columnNum + getPaddingLeft(); int top = (gridHeight + gridSpacing) * rowNum + getPaddingTop(); int right = left + gridWidth; int bottom = top + gridHeight; childrenView.layout(left, top, right, bottom); } } } 加了这个判断if(changed){}初步可以解决

这个是正解

cultivation-of-taoism avatar Mar 12 '19 08:03 cultivation-of-taoism

Application中的家在图片这样设置,这才是正解
Glide.with(context)
.load(url)
.error(R.drawable.ic_default_image)
.placeholder(R.drawable.ic_default_image)
.diskCacheStrategy(DiskCacheStrategy.ALL) .into(imageView);

8210503 avatar Sep 06 '19 09:09 8210503