This is my setup. I have a custom one ListViewwith some fancy headers that is inside ViewPager. I maintain a memory cache for images that have been downloaded and saved locally, like any self-respecting developer.
The problem that I am facing is that every time I call setImageBitmap(Bitmap bm)in ImageViewin my method ListView getView()using Bitmap from the cache, it calls all of my views before onMeasure(). I looked at the Android source code ImageViewand found this:
public void setImageDrawable(Drawable drawable) {
if (mDrawable != drawable) {
mResource = 0;
mUri = null;
int oldWidth = mDrawableWidth;
int oldHeight = mDrawableHeight;
updateDrawable(drawable);
if (oldWidth != mDrawableWidth || oldHeight != mDrawableHeight) {
requestLayout();
}
invalidate();
}
}
, , setImageDrawable ( setImageBitmap) , drawable , drawable. , ImageView 60dp x 60dp, .
, , ? onMeasure onLayout View, ListView ViewPager , , , (~ 100ms UI).
, . - - ?
.