RoundedBitmapDrawable

public abstract class RoundedBitmapDrawable
extends Drawable

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ androidx.core.graphics.drawable.RoundedBitmapDrawable


A Drawable that wraps a bitmap and can be drawn with rounded corners. You can create a RoundedBitmapDrawable from a file path, an input stream, or from a Bitmap object.

Also see the Bitmap class, which handles the management and transformation of raw bitmap graphics, and should be used when drawing to a Canvas.

Summary

Public methods

void draw(Canvas canvas)
int getAlpha()
final Bitmap getBitmap()

Returns the bitmap used by this drawable to render.

ColorFilter getColorFilter()
float getCornerRadius()
int getGravity()

Get the gravity used to position/stretch the bitmap within its bounds.

int getIntrinsicHeight()
int getIntrinsicWidth()
int getOpacity()
final Paint getPaint()

Returns the paint used to render this drawable.

boolean hasAntiAlias()

Indicates whether anti-aliasing is enabled for this drawable.

boolean hasMipMap()

Indicates whether the mipmap hint is enabled on this drawable's bitmap.

boolean isCircular()
void setAlpha(int alpha)
void setAntiAlias(boolean aa)

Enables or disables anti-aliasing for this drawable.

void setCircular(boolean circular)

Sets the image shape to circular.

void setColorFilter(ColorFilter cf)
void setCornerRadius(float cornerRadius)

Sets the corner radius to be applied when drawing the bitmap.

void setDither(boolean dither)
void setFilterBitmap(boolean filter)
void setGravity(int gravity)

Set the gravity used to position/stretch the bitmap within its bounds.

void setMipMap(boolean mipMap)

Enables or disables the mipmap hint for this drawable's bitmap.

void setTargetDensity(DisplayMetrics metrics)

Set the density scale at which this drawable will be rendered.

void setTargetDensity(Canvas canvas)

Set the density scale at which this drawable will be rendered.

void setTargetDensity(int density)

Set the density at which this drawable will be rendered.

Protected methods

void onBoundsChange(Rect bounds)

Inherited methods