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: 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! |
Creates a custom pointer icon from the given bitmap and hotspot information. |
| Int | |
| Boolean | |
| static PointerIcon! |
getSystemIcon(context: Context, type: Int)Gets a system pointer icon for the given type. |
| static PointerIcon! |
Loads a custom pointer icon from an XML resource. |
| Unit |
writeToParcel(out: Parcel!, flags: Int) |
| Properties | |
|---|---|
| static Parcelable.Creator<PointerIcon!> | |
Constants
TYPE_ALIAS
static val TYPE_ALIAS: Int
Type constant: alias (indicating an alias of/shortcut to something is to be created.
Value: 1010
TYPE_ALL_SCROLL
static val TYPE_ALL_SCROLL: Int
Type constant: all-scroll.
Value: 1013
TYPE_ARROW
static val TYPE_ARROW: Int
Type constant: Arrow icon. (Default mouse pointer)
Value: 1000
TYPE_CONTEXT_MENU
static val TYPE_CONTEXT_MENU: Int
Type constant: context-menu.
Value: 1001
TYPE_CROSSHAIR
static val TYPE_CROSSHAIR: Int
Type constant: crosshair.
Value: 1007
TYPE_DEFAULT
static val TYPE_DEFAULT: Int
The default pointer icon.
Value: 1000
TYPE_GRABBING
static val TYPE_GRABBING: Int
Type constant: grabbing.
Value: 1021
TYPE_HORIZONTAL_DOUBLE_ARROW
static val TYPE_HORIZONTAL_DOUBLE_ARROW: Int
Type constant: horizontal double arrow mainly for resizing.
Value: 1014
TYPE_NULL
static val TYPE_NULL: Int
Type constant: Null icon. It has no bitmap.
Value: 0
TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
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
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
static val TYPE_VERTICAL_DOUBLE_ARROW: Int
Type constant: vertical double arrow mainly for resizing.
Value: 1015
TYPE_VERTICAL_TEXT
static val TYPE_VERTICAL_TEXT: Int
Type constant: vertical-text.
Value: 1009
TYPE_ZOOM_OUT
static val TYPE_ZOOM_OUT: Int
Type constant: zoom-out.
Value: 1019
Public methods
create
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. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if bitmap is null, or if the x/y hotspot parameters are invalid. |
describeContents
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
fun equals(other: Any?): Boolean
| Parameters | |
|---|---|
obj |
the reference object with which to compare. |
| Return | |
|---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getSystemIcon
static fun getSystemIcon(
context: Context,
type: Int
): PointerIcon!
Gets a system pointer icon for the given type. If typeis not recognized, returns the default pointer icon.
| Parameters | |
|---|---|
context |
Context: The context. This value cannot be null. |
type |
Int: The pointer icon type. |
| Return | |
|---|---|
PointerIcon! |
The pointer icon. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if context is null. |
load
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. |
| 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. |
writeToParcel
fun writeToParcel(
out: Parcel!,
flags: Int
): Unit
| Parameters | |
|---|---|
dest |
The Parcel in which the object should be written. |
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 |