Weird animation on Gallery when a invalidate is requested from it's children

后端 未结 6 1505
春和景丽
春和景丽 2021-01-14 17:38

This is the adapter of my Gallery on which I display ImageViews (thumb of a page)

I want to load the images ASync (some times this can come from Network), so I did t

6条回答
  •  北恋
    北恋 (楼主)
    2021-01-14 18:37

    You can set a default bitmap before starting download of the actual image. This will make sure that the empty views dont get set with the wrong bitmaps.

    // load defaultBmp in constructor.
    
    image.setBackgroundColor(Color.WHITE);
    
    image.setLayoutParams(new Gallery.LayoutParams(96, 170));
    
    image.setImageBitmap(defaultBmp); // set the default bitmap (could be white). 
    // execute AsyncTask here.
    

提交回复
热议问题