added in version 25.4.0
belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1

FitWidthBitmapDrawable

public class FitWidthBitmapDrawable
extends Drawable

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ android.support.v17.leanback.graphics.FitWidthBitmapDrawable


Subclass of Drawable that can be used to draw a bitmap into a region. Bitmap will be scaled to fit the full width of the region and will be aligned to the top left corner. Any region outside the bounds will be clipped during draw(Canvas) call. Top position of the bitmap can be controlled by setVerticalOffset(int) call or PROPERTY_VERTICAL_OFFSET.

Summary

Fields

public static final Property<FitWidthBitmapDrawable, Integer> PROPERTY_VERTICAL_OFFSET

Property for setVerticalOffset(int) and getVerticalOffset().

Public constructors

FitWidthBitmapDrawable()

Public methods

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

Returns the bitmap.

Drawable.ConstantState getConstantState()
int getOpacity()
Rect getSource()

Returns the Rect used for extracting the bitmap.

int getVerticalOffset()

Returns the current vertical offset.

Drawable mutate()
void setAlpha(int alpha)
void setBitmap(Bitmap bitmap)

Sets the bitmap.

void setColorFilter(ColorFilter colorFilter)
void setSource(Rect source)

Sets the Rect used for extracting the bitmap.

void setVerticalOffset(int offset)

Sets the vertical offset which will be used for drawing the bitmap.

Inherited methods

From class android.graphics.drawable.Drawable
From class java.lang.Object

Fields

PROPERTY_VERTICAL_OFFSET

added in version 25.4.0
Property<FitWidthBitmapDrawable, Integer> PROPERTY_VERTICAL_OFFSET

Property for setVerticalOffset(int) and getVerticalOffset().

Public constructors

FitWidthBitmapDrawable

added in version 25.4.0
FitWidthBitmapDrawable ()

Public methods

draw

added in version 25.4.0
void draw (Canvas canvas)

Parameters
canvas Canvas

getAlpha

int getAlpha ()

Returns
int Alpha value between 0(inclusive) and 255(inclusive)

getBitmap

added in version 25.4.0
Bitmap getBitmap ()

Returns the bitmap.

Returns
Bitmap

getConstantState

Drawable.ConstantState getConstantState ()

Returns
Drawable.ConstantState

getOpacity

added in version 25.4.0
int getOpacity ()

Returns
int

getSource

added in version 25.4.0
Rect getSource ()

Returns the Rect used for extracting the bitmap.

Returns
Rect

getVerticalOffset

added in version 25.4.0
int getVerticalOffset ()

Returns the current vertical offset.

Returns
int

mutate

Drawable mutate ()

Returns
Drawable

setAlpha

added in version 25.4.0
void setAlpha (int alpha)

Parameters
alpha int

setBitmap

added in version 25.4.0
void setBitmap (Bitmap bitmap)

Sets the bitmap.

Parameters
bitmap Bitmap

setColorFilter

added in version 25.4.0
void setColorFilter (ColorFilter colorFilter)

Parameters
colorFilter ColorFilter

setSource

added in version 25.4.0
void setSource (Rect source)

Sets the Rect used for extracting the bitmap.

Parameters
source Rect

setVerticalOffset

added in version 25.4.0
void setVerticalOffset (int offset)

Sets the vertical offset which will be used for drawing the bitmap. The bitmap drawing will start the provided vertical offset.

Parameters
offset int