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

PointerIconCompat

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

Helper for accessing features in android.view.PointerIcon in a backwards compatible fashion.

Summary

Constants
static Int

Synonym for android.view.PointerIcon#TYPE_ALIAS

static Int

Synonym for android.view.PointerIcon#TYPE_ALL_SCROLL

static Int

Synonym for android.view.PointerIcon#TYPE_ARROW

static Int

Synonym for android.view.PointerIcon#TYPE_CELL

static Int

Synonym for android.view.PointerIcon#TYPE_CONTEXT_MENU

static Int

Synonym for android.view.PointerIcon#TYPE_COPY

static Int

Synonym for android.view.PointerIcon#TYPE_CROSSHAIR

static Int

Synonym for android.view.PointerIcon#TYPE_DEFAULT

static Int

Synonym for android.view.PointerIcon#TYPE_GRAB

static Int

Synonym for android.view.PointerIcon#TYPE_GRABBING

static Int

Synonym for android.view.PointerIcon#TYPE_HAND

static Int

Synonym for android.view.PointerIcon#TYPE_HELP

static Int

Synonym for android.view.PointerIcon#TYPE_HORIZONTAL_DOUBLE_ARROW

static Int

Synonym for android.view.PointerIcon#TYPE_NO_DROP

static Int

Synonym for android.view.PointerIcon#TYPE_NULL

static Int

Synonym for android.view.PointerIcon#TYPE_TEXT

static Int

Synonym for android.view.PointerIcon#TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

static Int

Synonym for android.view.PointerIcon#TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

static Int

Synonym for android.view.PointerIcon#TYPE_VERTICAL_DOUBLE_ARROW

static Int

Synonym for android.view.PointerIcon#TYPE_VERTICAL_TEXT

static Int

Synonym for android.view.PointerIcon#TYPE_WAIT

static Int

Synonym for android.view.PointerIcon#TYPE_ZOOM_IN

static Int

Synonym for android.view.PointerIcon#TYPE_ZOOM_OUT

Public methods
static PointerIconCompat!
create(bitmap: Bitmap!, hotSpotX: Float, hotSpotY: Float)

Creates a custom pointer from the given bitmap and hotspot information.

static PointerIconCompat!
getSystemIcon(context: Context!, style: Int)

Gets a system pointer icon for the given style.

static PointerIconCompat!
load(resources: Resources!, resourceId: Int)

Loads a custom pointer icon from an XML resource.

Constants

TYPE_ALIAS

static val TYPE_ALIAS: Int

Synonym for android.view.PointerIcon#TYPE_ALIAS

Value: 1010

TYPE_ALL_SCROLL

static val TYPE_ALL_SCROLL: Int

Synonym for android.view.PointerIcon#TYPE_ALL_SCROLL

Value: 1013

TYPE_ARROW

static val TYPE_ARROW: Int

Synonym for android.view.PointerIcon#TYPE_ARROW

Value: 1000

TYPE_CELL

static val TYPE_CELL: Int

Synonym for android.view.PointerIcon#TYPE_CELL

Value: 1006

TYPE_CONTEXT_MENU

static val TYPE_CONTEXT_MENU: Int

Synonym for android.view.PointerIcon#TYPE_CONTEXT_MENU

Value: 1001

TYPE_COPY

static val TYPE_COPY: Int

Synonym for android.view.PointerIcon#TYPE_COPY

Value: 1011

TYPE_CROSSHAIR

static val TYPE_CROSSHAIR: Int

Synonym for android.view.PointerIcon#TYPE_CROSSHAIR

Value: 1007

TYPE_DEFAULT

static val TYPE_DEFAULT: Int

Synonym for android.view.PointerIcon#TYPE_DEFAULT

Value: TYPE_ARROW

TYPE_GRAB

static val TYPE_GRAB: Int

Synonym for android.view.PointerIcon#TYPE_GRAB

Value: 1020

TYPE_GRABBING

static val TYPE_GRABBING: Int

Synonym for android.view.PointerIcon#TYPE_GRABBING

Value: 1021

TYPE_HAND

static val TYPE_HAND: Int

Synonym for android.view.PointerIcon#TYPE_HAND

Value: 1002

TYPE_HELP

static val TYPE_HELP: Int

Synonym for android.view.PointerIcon#TYPE_HELP

Value: 1003

TYPE_HORIZONTAL_DOUBLE_ARROW

static val TYPE_HORIZONTAL_DOUBLE_ARROW: Int

Synonym for android.view.PointerIcon#TYPE_HORIZONTAL_DOUBLE_ARROW

Value: 1014

TYPE_NO_DROP

static val TYPE_NO_DROP: Int

Synonym for android.view.PointerIcon#TYPE_NO_DROP

Value: 1012

TYPE_NULL

static val TYPE_NULL: Int

Synonym for android.view.PointerIcon#TYPE_NULL

Value: 0

TYPE_TEXT

static val TYPE_TEXT: Int

Synonym for android.view.PointerIcon#TYPE_TEXT

Value: 1008

TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

static val TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW: Int

Synonym for android.view.PointerIcon#TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Value: 1017

TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

static val TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW: Int

Synonym for android.view.PointerIcon#TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Value: 1016

TYPE_VERTICAL_DOUBLE_ARROW

static val TYPE_VERTICAL_DOUBLE_ARROW: Int

Synonym for android.view.PointerIcon#TYPE_VERTICAL_DOUBLE_ARROW

Value: 1015

TYPE_VERTICAL_TEXT

static val TYPE_VERTICAL_TEXT: Int

Synonym for android.view.PointerIcon#TYPE_VERTICAL_TEXT

Value: 1009

TYPE_WAIT

static val TYPE_WAIT: Int

Synonym for android.view.PointerIcon#TYPE_WAIT

Value: 1004

TYPE_ZOOM_IN

static val TYPE_ZOOM_IN: Int

Synonym for android.view.PointerIcon#TYPE_ZOOM_IN

Value: 1018

TYPE_ZOOM_OUT

static val TYPE_ZOOM_OUT: Int

Synonym for android.view.PointerIcon#TYPE_ZOOM_OUT

Value: 1019

Public methods

create

static fun create(
    bitmap: Bitmap!,
    hotSpotX: Float,
    hotSpotY: Float
): PointerIconCompat!

Creates a custom pointer from the given bitmap and hotspot information.

Parameters
bitmap Bitmap!: The bitmap for the icon.
hotSpotX Float: The X offset of the pointer icon hotspot in the bitmap. Must be within the [0, bitmap.getWidth()) range.
hotSpotY Float: The Y offset of the pointer icon hotspot in the bitmap. Must be within the [0, bitmap.getHeight()) range.
Return
PointerIconCompat! A pointer icon for this bitmap.
Exceptions
IllegalArgumentException if bitmap is null, or if the x/y hotspot parameters are invalid.

getSystemIcon

static fun getSystemIcon(
    context: Context!,
    style: Int
): PointerIconCompat!

Gets a system pointer icon for the given style. If style is not recognized, returns the default pointer icon.

Parameters
context Context!: The context.
style Int: The pointer icon style.
Return
PointerIconCompat! The pointer icon.
Exceptions
IllegalArgumentException if context is null.

load

static fun load(
    resources: Resources!,
    resourceId: Int
): PointerIconCompat!

Loads a custom pointer icon from an XML resource.

The XML resource should have the following form: <?xml version="1.0" encoding="utf-8"?> <pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" android:bitmap="@drawable/my_pointer_bitmap" android:hotSpotX="24" android:hotSpotY="24" />

Parameters
resources Resources!: The resources object.
resourceId Int: The resource id.
Return
PointerIconCompat! The pointer icon.
Exceptions
IllegalArgumentException if resources is null.
Resources.NotFoundException if the resource was not found or the drawable linked in the resource was not found.