Google 致力于为黑人社区推动种族平等。查看具体举措

RoundedBitmapDrawable

abstract class RoundedBitmapDrawable : Drawable
kotlin.Any
   ↳ 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 android.graphics.Bitmap object.

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

Summary

Public methods
open Unit
draw(@NonNull canvas: Canvas)

open Int

Bitmap?

Returns the bitmap used by this drawable to render.

open ColorFilter?

open Float

open Int

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

open Int

open Int

open Int

Paint

Returns the paint used to render this drawable.

open Boolean

Indicates whether anti-aliasing is enabled for this drawable.

open Boolean

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

open Boolean

open Unit
setAlpha(alpha: Int)

open Unit

Enables or disables anti-aliasing for this drawable.

open Unit
setCircular(circular: Boolean)

Sets the image shape to circular.

open Unit

open Unit
setCornerRadius(cornerRadius: Float)

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

open Unit
setDither(dither: Boolean)

open Unit

open Unit
setGravity(gravity: Int)

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

open Unit
setMipMap(mipMap: Boolean)

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

open Unit
setTargetDensity(@NonNull canvas: Canvas)

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

open Unit
setTargetDensity(@NonNull metrics: DisplayMetrics)

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

open Unit

Set the density at which this drawable will be rendered.

Protected methods
open Unit
onBoundsChange(bounds: Rect!)

Public methods

draw

open fun draw(@NonNull canvas: Canvas): Unit

getAlpha

open fun getAlpha(): Int

getBitmap

@Nullable fun getBitmap(): Bitmap?

Returns the bitmap used by this drawable to render. May be null.

getColorFilter

open fun getColorFilter(): ColorFilter?

getCornerRadius

open fun getCornerRadius(): Float
Return
Float The corner radius applied when drawing the bitmap.

getGravity

open fun getGravity(): Int

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

Return
Int the gravity applied t