PointerIconCompat

Added in 1.1.0

class PointerIconCompat


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

Summary

Constants

const Int
TYPE_ALIAS = 1010

Synonym for TYPE_ALIAS

const Int

Synonym for TYPE_ALL_SCROLL

const Int
TYPE_ARROW = 1000

Synonym for TYPE_ARROW

const Int
TYPE_CELL = 1006

Synonym for TYPE_CELL

const Int

Synonym for TYPE_CONTEXT_MENU

const Int
TYPE_COPY = 1011

Synonym for TYPE_COPY

const Int

Synonym for TYPE_CROSSHAIR

const Int

Synonym for TYPE_DEFAULT

const Int
TYPE_GRAB = 1020

Synonym for TYPE_GRAB

const Int

Synonym for TYPE_GRABBING

const Int
TYPE_HAND = 1002

Synonym for TYPE_HAND

const Int
TYPE_HELP = 1003

Synonym for TYPE_HELP

const Int

Synonym for TYPE_HORIZONTAL_DOUBLE_ARROW

const Int

Synonym for TYPE_NO_DROP

const Int

Synonym for TYPE_NULL

const Int
TYPE_TEXT = 1008

Synonym for TYPE_TEXT

const Int

Synonym for TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

const Int

Synonym for TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

const Int

Synonym for TYPE_VERTICAL_DOUBLE_ARROW

const Int

Synonym for TYPE_VERTICAL_TEXT

const Int
TYPE_WAIT = 1004

Synonym for TYPE_WAIT

const Int

Synonym for TYPE_ZOOM_IN

const Int

Synonym for TYPE_ZOOM_OUT

Public functions

java-static PointerIconCompat
create(bitmap: Bitmap, hotSpotX: Float, hotSpotY: Float)

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

java-static PointerIconCompat
getSystemIcon(context: Context, style: Int)

Gets a system pointer icon for the given style.

java-static PointerIconCompat
load(resources: Resources, resourceId: Int)

Loads a custom pointer icon from an XML resource.

Constants

TYPE_ALIAS

Added in 1.1.0
const val TYPE_ALIAS = 1010: Int

Synonym for TYPE_ALIAS

TYPE_ALL_SCROLL

Added in 1.1.0
const val TYPE_ALL_SCROLL = 1013: Int

Synonym for TYPE_ALL_SCROLL

TYPE_ARROW

Added in 1.1.0
const val TYPE_ARROW = 1000: Int

Synonym for TYPE_ARROW

TYPE_CELL

Added in 1.1.0
const val TYPE_CELL = 1006: Int

Synonym for TYPE_CELL

TYPE_CONTEXT_MENU

Added in 1.1.0
const val TYPE_CONTEXT_MENU = 1001: Int

Synonym for TYPE_CONTEXT_MENU

TYPE_COPY

Added in 1.1.0
const val TYPE_COPY = 1011: Int

Synonym for TYPE_COPY

TYPE_CROSSHAIR

Added in 1.1.0
const val TYPE_CROSSHAIR = 1007: Int

Synonym for TYPE_CROSSHAIR

TYPE_DEFAULT

Added in 1.1.0
const val TYPE_DEFAULT = 1000: Int

Synonym for TYPE_DEFAULT

TYPE_GRAB

Added in 1.1.0
const val TYPE_GRAB = 1020: Int

Synonym for TYPE_GRAB

TYPE_GRABBING

Added in 1.1.0
const val TYPE_GRABBING = 1021: Int

Synonym for TYPE_GRABBING

TYPE_HAND

Added in 1.1.0
const val TYPE_HAND = 1002: Int

Synonym for TYPE_HAND

TYPE_HELP

Added in 1.1.0
const val TYPE_HELP = 1003: Int

Synonym for TYPE_HELP

TYPE_HORIZONTAL_DOUBLE_ARROW

Added in 1.1.0
const val TYPE_HORIZONTAL_DOUBLE_ARROW = 1014: Int

Synonym for TYPE_HORIZONTAL_DOUBLE_ARROW

TYPE_NO_DROP

Added in 1.1.0
const val TYPE_NO_DROP = 1012: Int

Synonym for TYPE_NO_DROP

TYPE_NULL

Added in 1.1.0
const val TYPE_NULL = 0: Int

Synonym for TYPE_NULL

TYPE_TEXT

Added in 1.1.0
const val TYPE_TEXT = 1008: Int

Synonym for TYPE_TEXT

TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Added in 1.1.0
const val TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017: Int

Synonym for TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Added in 1.1.0
const val TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016: Int

Synonym for TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

TYPE_VERTICAL_DOUBLE_ARROW

Added in 1.1.0
const val TYPE_VERTICAL_DOUBLE_ARROW = 1015: Int

Synonym for TYPE_VERTICAL_DOUBLE_ARROW

TYPE_VERTICAL_TEXT

Added in 1.1.0
const val TYPE_VERTICAL_TEXT = 1009: Int

Synonym for TYPE_VERTICAL_TEXT

TYPE_WAIT

Added in 1.1.0
const val TYPE_WAIT = 1004: Int

Synonym for TYPE_WAIT

TYPE_ZOOM_IN

Added in 1.1.0
const val TYPE_ZOOM_IN = 1018: Int

Synonym for TYPE_ZOOM_IN

TYPE_ZOOM_OUT

Added in 1.1.0
const val TYPE_ZOOM_OUT = 1019: Int

Synonym for TYPE_ZOOM_OUT

Public functions

create

Added in 1.1.0
java-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.

Returns
PointerIconCompat

A pointer icon for this bitmap.

Throws
java.lang.IllegalArgumentException

if bitmap is null, or if the x/y hotspot parameters are invalid.

getSystemIcon

Added in 1.1.0
java-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.

Returns
PointerIconCompat

The pointer icon.

load

Added in 1.1.0
java-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.

Returns
PointerIconCompat

The pointer icon.

Throws
android.content.res.Resources.NotFoundException

if the resource was not found or the drawable linked in the resource was not found.