Java android.graphics.drawable BitmapDrawable fields, constructors, methods, implement or subclass

Example usage for Java android.graphics.drawable BitmapDrawable fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.graphics.drawable BitmapDrawable.

The text is from its open source code.

Subclass

android.graphics.drawable.BitmapDrawable has subclasses.
Click this link to see all its subclasses.

Constructor

BitmapDrawable(Resources res)
Create an empty drawable, setting initial target density based on the display metrics of the resources.
BitmapDrawable(Bitmap bitmap)
Create drawable from a bitmap, not dealing with density.
BitmapDrawable(String filepath)
Create a drawable by opening a given file path and decoding the bitmap.
BitmapDrawable(java.io.InputStream is)
Create a drawable by decoding a bitmap from the given input stream.
BitmapDrawable(Resources res, Bitmap bitmap)
Create drawable from a bitmap, setting initial target density based on the display metrics of the resources.
BitmapDrawable(Resources res, String filepath)
Create a drawable by opening a given file path and decoding the bitmap.
BitmapDrawable(Resources res, java.io.InputStream is)
Create a drawable by decoding a bitmap from the given input stream.
BitmapDrawable(BitmapState state, Resources res)
BitmapDrawable()
Create an empty drawable, not dealing with density.

Method

voiddraw(Canvas canvas)
BitmapgetBitmap()
Returns the bitmap used by this drawable to render.
RectgetBounds()
Return the drawable's bounds Rect.
ConstantStategetConstantState()
intgetIntrinsicHeight()
intgetIntrinsicWidth()
PaintgetPaint()
Returns the paint used to render this drawable.
Drawablemutate()
A mutable BitmapDrawable still shares its Bitmap with any other Drawable that comes from the same resource.
voidsetAlpha(int alpha)
voidsetAntiAlias(boolean aa)
Enables or disables anti-aliasing for this drawable.
voidsetBounds(int left, int top, int right, int bottom)
Specify a bounding rectangle for the Drawable.
voidsetBounds(@NonNull Rect bounds)
Specify a bounding rectangle for the Drawable.
voidsetCallback(@Nullable Callback cb)
Bind a Callback object to this Drawable.
voidsetColorFilter(ColorFilter colorFilter)
voidsetDither(boolean dither)
voidsetFilterBitmap(boolean filter)
voidsetGravity(int gravity)
Set the gravity used to position/stretch the bitmap within its bounds.
voidsetTargetDensity(Canvas canvas)
Set the density scale at which this drawable will be rendered.
voidsetTargetDensity(DisplayMetrics metrics)
Set the density scale at which this drawable will be rendered.
voidsetTargetDensity(int density)
Set the density at which this drawable will be rendered.
voidsetTileModeX(Shader.TileMode mode)
Sets the repeat behavior of this drawable on the X axis.
voidsetTileModeXY(Shader.TileMode xmode, Shader.TileMode ymode)
Sets the repeat behavior of this drawable on both axis.
voidsetTileModeY(Shader.TileMode mode)
Sets the repeat behavior of this drawable on the Y axis.