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

DisplayCutoutCompat

class DisplayCutoutCompat
kotlin.Any
   ↳ androidx.core.view.DisplayCutoutCompat

Represents the area of the display that is not functional for displaying content.

DisplayCutoutCompat instances are immutable.

Summary

Public constructors
<init>(safeInsets: Rect!, boundingRects: MutableList<Rect!>!)

Creates a DisplayCutout instance.

<init>(@NonNull safeInsets: Insets, @Nullable boundLeft: Rect?, @Nullable boundTop: Rect?, @Nullable boundRight: Rect?, @Nullable boundBottom: Rect?, @NonNull waterfallInsets: Insets)

Creates a DisplayCutout instance.

Public methods
Boolean
equals(other: Any?)

MutableList<Rect!>

Returns a list of Rects, each of which is the bounding rectangle for a non-functional area on the display.

Int

Returns the inset from the bottom which avoids the display cutout in pixels.

Int

Returns the inset from the left which avoids the display cutout in pixels.

Int

Returns the inset from the right which avoids the display cutout in pixels.

Int

Returns the inset from the top which avoids the display cutout in pixels.

Insets

Returns the insets representing the curved areas of a waterfall display.

Int

String

Public constructors

<init>

DisplayCutoutCompat(
    safeInsets: Rect!,
    boundingRects: MutableList<Rect!>!)

Creates a DisplayCutout instance.

Parameters
safeInsets Rect!: the insets from each edge which avoid the display cutout as returned by getSafeInsetTop() etc.
boundingRects MutableList<Rect!>!: the bounding rects of the display cutouts as returned by getBoundingRects() ()}.

<init>

DisplayCutoutCompat(
    @NonNull safeInsets: Insets,
    @Nullable boundLeft: Rect?,
    @Nullable boundTop: Rect?,
    @Nullable boundRight: Rect?,
    @Nullable boundBottom: Rect?,
    @NonNull waterfallInsets: Insets)

Creates a DisplayCutout instance.

Parameters
safeInsets Insets: the insets from each edge which avoid the display cutout as returned by getSafeInsetTop() etc.
boundLeft Rect?: the left bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0).
boundTop Rect?: the top bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0).
boundRight Rect?: the right bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0).
boundBottom Rect?: the bottom bounding rect of the display cutout in pixels. If null is passed, it's treated as an empty rectangle (0,0)-(0,0).
waterfallInsets Insets: the insets for the curved areas in waterfall display.

Public methods

equals

fun equals(other: Any?): Boolean

getBoundingRects

@NonNull fun getBoundingRects(): MutableList<Rect!>

Returns a list of Rects, each of which is the bounding rectangle for a non-functional area on the display. There will be at most one non-functional area per short edge of the device, and none on the long edges.

Return
MutableList<Rect!>