private void updateThumbnailMatrix(){
  if (mThumbnail == null)   return;
  if (mImageMatrix == null)   mImageMatrix=new Matrix();
  float widthScale=(float)getMeasuredWidth() / mThumbnail.getWidth();
  float heightScale=(float)getMeasuredHeight() / mThumbnail.getHeight();
  float scale=Math.max(widthScale,heightScale);
  mImageMatrix.setScale(scale,scale);
  setImageMatrix(mImageMatrix);
}

private void updateThumbnailMatrix ( ) { if ( mThumbnail == null ) return ; if ( mImageMatrix == null ) mImageMatrix = new Matrix ( ) ; float widthScale = ( float ) getMeasuredWidth ( ) / mThumbnail . getWidth ( ) ; float heightScale = ( float ) getMeasuredHeight ( ) / mThumbnail . getHeight ( ) ; float scale = Math . max ( widthScale , heightScale ) ; mImageMatrix . setScale ( scale , scale ) ; setImageMatrix ( mImageMatrix ) ; }
updates the matrix used to scale the thumbnail when drawing it . this needs to be called whenever the thumbnail changes or this view ' s size changes . this matrix ensures that the thumbnail is anchored at the top left corner of this view and is scaled as small as possible while still covering the entire view . surprisingly , there ' s no way to get this behavior using the other imageview . scaletypes .
