androidx.core.graphics.drawable
Classes
DrawableCompat |
Helper for accessing features in |
IconCompat |
Helper for accessing features in |
RoundedBitmapDrawable |
A Drawable that wraps a bitmap and can be drawn with rounded corners. |
RoundedBitmapDrawableFactory |
Constructs |
Extension functions summary
For android.graphics.Bitmap | |
Icon | |
BitmapDrawable |
Bitmap.toDrawable(resources: Resources) Create a BitmapDrawable from this Bitmap. |
Icon |
For android.graphics.Color | |
ColorDrawable |
Create a ColorDrawable from this Color (via Color.toArgb). |
For android.graphics.drawable.Drawable | |
Bitmap | |
Unit |
Drawable.updateBounds(@Px left: Int = bounds.left, @Px top: Int = bounds.top, @Px right: Int = bounds.right, @Px bottom: Int = bounds.bottom) Updates this drawable's bounds. |
For android.net.Uri | |
Icon |
For kotlin.ByteArray | |
Icon |
For kotlin.Int | |
ColorDrawable |
Create a ColorDrawable from this color value. |
Extension functions
toAdaptiveIcon
@RequiresApi(26) inline fun Bitmap.toAdaptiveIcon(): Icon
Create an Icon from this adaptive Bitmap.
See Also
toBitmap
fun Drawable.toBitmap(
@Px width: Int = intrinsicWidth,
@Px height: Int = intrinsicHeight,
config: Config? = null
): Bitmap
Return a Bitmap representation of this Drawable.
If this instance is a BitmapDrawable and the width, height, and config match, the underlying Bitmap instance will be returned directly. If any of those three properties differ then a new Bitmap is created. For all other Drawable types, a new Bitmap is created.
Parameters | |
---|---|
width: Int = intrinsicWidth | Width of the desired bitmap. Defaults to Drawable.getIntrinsicWidth. |
height: Int = intrinsicHeight | Height of the desired bitmap. Defaults to Drawable.getIntrinsicHeight. |
config: Config? = null | Bitmap config of the desired bitmap. Null attempts to use the native config, if any. Defaults to Config.ARGB_8888 otherwise. |
toDrawable
inline fun Bitmap.toDrawable(resources: Resources): BitmapDrawable
Create a BitmapDrawable from this Bitmap.
toDrawable
@RequiresApi(26) inline fun Color.toDrawable(): ColorDrawable
Create a ColorDrawable from this Color (via Color.toArgb).
toDrawable
inline fun Int.toDrawable():