FixedSizeImageViewpublic class FixedSizeImageView extends android.widget.ImageView This is an optimized ImageView that does not trigger a requestLayout() or invalidate() when
setting the image to Null. |
Fields Summary |
---|
boolean | mAllowRelayout | boolean | mAllowInvalidate |
Constructors Summary |
---|
public FixedSizeImageView(android.content.Context context)
this(context, null);
| public FixedSizeImageView(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, 0);
| public FixedSizeImageView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
| public FixedSizeImageView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
|
Methods Summary |
---|
public void | invalidate()
if (mAllowInvalidate) {
super.invalidate();
}
| public void | requestLayout()
if (mAllowRelayout) {
super.requestLayout();
}
| public void | setImageDrawable(android.graphics.drawable.Drawable drawable)
boolean isNullBitmapDrawable = (drawable instanceof BitmapDrawable) &&
(((BitmapDrawable) drawable).getBitmap() == null);
if (drawable == null || isNullBitmapDrawable) {
mAllowRelayout = false;
mAllowInvalidate = false;
}
super.setImageDrawable(drawable);
mAllowRelayout = true;
mAllowInvalidate = true;
|
|