Added in API level 24

PointerIcon

class PointerIcon : Parcelable
kotlin.Any
   ↳ android.view.PointerIcon

Represents an icon that can be used as a mouse pointer.

Pointer icons can be provided either by the system using system types, or by applications using bitmaps or application resources.

Summary

Constants
static Int

Type constant: alias (indicating an alias of/shortcut to something is to be created.

static Int

Type constant: all-scroll.

static Int

Type constant: Arrow icon.

static Int

Type constant: cell.

static Int

Type constant: context-menu.

static Int

Type constant: copy.

static Int

Type constant: crosshair.

static Int

The default pointer icon.

static Int

Type constant: grab.

static Int

Type constant: grabbing.

static Int

Type constant: hand.

static Int

Type constant: handwriting.

static Int

Type constant: help.

static Int

Type constant: horizontal double arrow mainly for resizing.

static Int

Type constant: no-drop.

static Int

Type constant: Null icon.

static Int

Type constant: text.

static Int

Type constant: diagonal double arrow -- top-left to bottom-right.

static Int

Type constant: diagonal double arrow -- top-right to bottom-left.

static Int

Type constant: vertical double arrow mainly for resizing.

static Int

Type constant: vertical-text.

static Int

Type constant: wait.

static Int

Type constant: zoom-in.

static Int

Type constant: zoom-out.

Inherited constants
Public methods
static PointerIcon
create(bitmap: Bitmap, hotSpotX: Float, hotSpotY: Float)

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

Int

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

static PointerIcon
getSystemIcon(context: Context, type: Int)

Gets a system pointer icon for the given type.

static PointerIcon
load(resources: Resources, resourceId: Int)

Loads a custom pointer icon from an XML resource.

String

Unit
writeToParcel(out: Parcel, flags: Int)

Properties
static Parcelable.Creator<PointerIcon!>

Constants

TYPE_ALIAS

Added in API level 24
static val TYPE_ALIAS: Int

Type constant: alias (indicating an alias of/shortcut to something is to be created.

Value: 1010

TYPE_ALL_SCROLL

Added in API level 24
static val TYPE_ALL_SCROLL: Int

Type constant: all-scroll.

Value: 1013

TYPE_ARROW

Added in API level 24
static val TYPE_ARROW: Int

Type constant: Arrow icon. (Default mouse pointer)

Value: 1000

TYPE_CELL

Added in API level 24
static val TYPE_CELL: Int

Type constant: cell.

Value: 1006

TYPE_CONTEXT_MENU

Added in API level 24
static val TYPE_CONTEXT_MENU: Int

Type constant: context-menu.

Value: 1001

TYPE_COPY

Added in API level 24
static val TYPE_COPY: Int

Type constant: copy.

Value: 1011

TYPE_CROSSHAIR

Added in API level 24
static val TYPE_CROSSHAIR: Int

Type constant: crosshair.

Value: 1007

TYPE_DEFAULT

static val TYPE_DEFAULT: Int

Deprecated: This is the same as using TYPE_ARROW. Use TYPE_ARROW to explicitly show an arrow, or use a null PointerIcon with View#setPointerIcon(PointerIcon) or View#onResolvePointerIcon(MotionEvent, int) instead to show the default pointer icon.

The default pointer icon.

Value: 1000

TYPE_GRAB

Added in API level 24
static val TYPE_GRAB: Int

Type constant: grab.

Value: 1020

TYPE_GRABBING

Added in API level 24
static val TYPE_GRABBING: Int

Type constant: grabbing.

Value: 1021

TYPE_HAND

Added in API level 24
static val TYPE_HAND: Int

Type constant: hand.

Value: 1002

TYPE_HANDWRITING

Added in API level 34
static val TYPE_HANDWRITING: Int

Type constant: handwriting.

Value: 1022

TYPE_HELP

Added in API level 24
static val TYPE_HELP: Int

Type constant: help.

Value: 1003

TYPE_HORIZONTAL_DOUBLE_ARROW

Added in API level 24
static val TYPE_HORIZONTAL_DOUBLE_ARROW: Int

Type constant: horizontal double arrow mainly for resizing.

Value: 1014

TYPE_NO_DROP

Added in API level 24
static val TYPE_NO_DROP: Int

Type constant: no-drop.

Value: 1012

TYPE_NULL

Added in API level 24
static val TYPE_NULL: Int

Type constant: Null icon. It has no bitmap.

Value: 0

TYPE_TEXT

Added in API level 24
static val TYPE_TEXT: Int

Type constant: text.

Value: 1008

TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Added in API level 24
static val TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW: Int

Type constant: diagonal double arrow -- top-left to bottom-right.

Value: 1017

TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Added in API level 24
static val TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW: Int

Type constant: diagonal double arrow -- top-right to bottom-left.

Value: 1016

TYPE_VERTICAL_DOUBLE_ARROW

Added in API level 24
static val TYPE_VERTICAL_DOUBLE_ARROW: Int

Type constant: vertical double arrow mainly for resizing.

Value: 1015

TYPE_VERTICAL_TEXT

Added in API level 24
static val TYPE_VERTICAL_TEXT: Int

Type constant: vertical-text.

Value: 1009

TYPE_WAIT

Added in API level 24
static val TYPE_WAIT: Int

Type constant: wait.

Value: 1004

TYPE_ZOOM_IN

Added in API level 24
static val TYPE_ZOOM_IN: Int

Type constant: zoom-in.

Value: 1018

TYPE_ZOOM_OUT

Added in API level 24
static val TYPE_ZOOM_OUT: Int

Type constant: zoom-out.

Value: 1019

Public methods

create

Added in API level 24
static fun create(
    bitmap: Bitmap,
    hotSpotX: Float,
    hotSpotY: Float
): PointerIcon

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

Parameters
bitmap Bitmap: The bitmap for the icon. This value cannot be null.
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
PointerIcon A pointer icon for this bitmap. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if bitmap is null, or if the x/y hotspot parameters are invalid.

describeContents

Added in API level 24
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 24
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
other Any?: This value may be null.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getSystemIcon

Added in API level 24
static fun getSystemIcon(
    context: Context,
    type: Int
): PointerIcon

Gets a system pointer icon for the given type.

Parameters
context Context: The context. This value cannot be null.
type Int: The pointer icon type.
Return
PointerIcon The pointer icon. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if context is null.

load

Added in API level 24
static fun load(
    resources: Resources,
    resourceId: Int
): PointerIcon

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. This value cannot be null.
resourceId Int: The resource id.
Return
PointerIcon The pointer icon. This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if resources is null.
android.content.res.Resources.NotFoundException if the resource was not found or the drawable linked in the resource was not found.

toString

Added in API level 24
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 24
fun writeToParcel(
    out: Parcel,
    flags: Int
): Unit
Parameters
dest The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 24
static val CREATOR: Parcelable.Creator<PointerIcon!>