PointerIconCompat

public final class PointerIconCompat
extends Object

java.lang.Object
   ↳ androidx.core.view.PointerIconCompat


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

Summary

Constants

int TYPE_ALIAS

Synonym for PointerIcon.TYPE_ALIAS

int TYPE_ALL_SCROLL

Synonym for PointerIcon.TYPE_ALL_SCROLL

int TYPE_ARROW

Synonym for PointerIcon.TYPE_ARROW

int TYPE_CELL

Synonym for PointerIcon.TYPE_CELL

int TYPE_CONTEXT_MENU

Synonym for PointerIcon.TYPE_CONTEXT_MENU

int TYPE_COPY

Synonym for PointerIcon.TYPE_COPY

int TYPE_CROSSHAIR

Synonym for PointerIcon.TYPE_CROSSHAIR

int TYPE_DEFAULT

Synonym for PointerIcon.TYPE_DEFAULT

int TYPE_GRAB

Synonym for PointerIcon.TYPE_GRAB

int TYPE_GRABBING

Synonym for PointerIcon.TYPE_GRABBING

int TYPE_HAND

Synonym for PointerIcon.TYPE_HAND

int TYPE_HELP

Synonym for PointerIcon.TYPE_HELP

int TYPE_HORIZONTAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW

int TYPE_NO_DROP

Synonym for PointerIcon.TYPE_NO_DROP

int TYPE_NULL

Synonym for PointerIcon.TYPE_NULL

int TYPE_TEXT

Synonym for PointerIcon.TYPE_TEXT

int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

int TYPE_VERTICAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW

int TYPE_VERTICAL_TEXT

Synonym for PointerIcon.TYPE_VERTICAL_TEXT

int TYPE_WAIT

Synonym for PointerIcon.TYPE_WAIT

int TYPE_ZOOM_IN

Synonym for PointerIcon.TYPE_ZOOM_IN

int TYPE_ZOOM_OUT

Synonym for PointerIcon.TYPE_ZOOM_OUT

Public methods

static PointerIconCompat create(Bitmap bitmap, float hotSpotX, float hotSpotY)

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

static PointerIconCompat getSystemIcon(Context context, int style)

Gets a system pointer icon for the given style.

static PointerIconCompat load(Resources resources, int resourceId)

Loads a custom pointer icon from an XML resource.

Inherited methods

Constants

TYPE_ALIAS

public static final int TYPE_ALIAS

Synonym for PointerIcon.TYPE_ALIAS

Constant Value: 1010 (0x000003f2)

TYPE_ALL_SCROLL

public static final int TYPE_ALL_SCROLL

Synonym for PointerIcon.TYPE_ALL_SCROLL

Constant Value: 1013 (0x000003f5)

TYPE_ARROW

public static final int TYPE_ARROW

Synonym for PointerIcon.TYPE_ARROW

Constant Value: 1000 (0x000003e8)

TYPE_CELL

public static final int TYPE_CELL

Synonym for PointerIcon.TYPE_CELL

Constant Value: 1006 (0x000003ee)

TYPE_CONTEXT_MENU

public static final int TYPE_CONTEXT_MENU

Synonym for PointerIcon.TYPE_CONTEXT_MENU

Constant Value: 1001 (0x000003e9)

TYPE_COPY

public static final int TYPE_COPY

Synonym for PointerIcon.TYPE_COPY

Constant Value: 1011 (0x000003f3)

TYPE_CROSSHAIR

public static final int TYPE_CROSSHAIR

Synonym for PointerIcon.TYPE_CROSSHAIR

Constant Value: 1007 (0x000003ef)

TYPE_DEFAULT

public static final int TYPE_DEFAULT

Synonym for PointerIcon.TYPE_DEFAULT

Constant Value: 1000 (0x000003e8)

TYPE_GRAB

public static final int TYPE_GRAB

Synonym for PointerIcon.TYPE_GRAB

Constant Value: 1020 (0x000003fc)

TYPE_GRABBING

public static final int TYPE_GRABBING

Synonym for PointerIcon.TYPE_GRABBING

Constant Value: 1021 (0x000003fd)

TYPE_HAND

public static final int TYPE_HAND

Synonym for PointerIcon.TYPE_HAND

Constant Value: 1002 (0x000003ea)

TYPE_HELP

public static final int TYPE_HELP

Synonym for PointerIcon.TYPE_HELP

Constant Value: 1003 (0x000003eb)

TYPE_HORIZONTAL_DOUBLE_ARROW

public static final int TYPE_HORIZONTAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW

Constant Value: 1014 (0x000003f6)

TYPE_NO_DROP

public static final int TYPE_NO_DROP

Synonym for PointerIcon.TYPE_NO_DROP

Constant Value: 1012 (0x000003f4)

TYPE_NULL

public static final int TYPE_NULL

Synonym for PointerIcon.TYPE_NULL

Constant Value: 0 (0x00000000)

TYPE_TEXT

public static final int TYPE_TEXT

Synonym for PointerIcon.TYPE_TEXT

Constant Value: 1008 (0x000003f0)

TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Constant Value: 1017 (0x000003f9)

TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Constant Value: 1016 (0x000003f8)

TYPE_VERTICAL_DOUBLE_ARROW

public static final int TYPE_VERTICAL_DOUBLE_ARROW

Synonym for PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW

Constant Value: 1015 (0x000003f7)

TYPE_VERTICAL_TEXT

public static final int TYPE_VERTICAL_TEXT

Synonym for PointerIcon.TYPE_VERTICAL_TEXT

Constant Value: 1009 (0x000003f1)

TYPE_WAIT

public static final int TYPE_WAIT

Synonym for PointerIcon.TYPE_WAIT

Constant Value: 1004 (0x000003ec)

TYPE_ZOOM_IN

public static final int TYPE_ZOOM_IN

Synonym for PointerIcon.TYPE_ZOOM_IN

Constant Value: 1018 (0x000003fa)

TYPE_ZOOM_OUT

public static final int TYPE_ZOOM_OUT

Synonym for PointerIcon.TYPE_ZOOM_OUT

Constant Value: 1019 (0x000003fb)

Public methods

create

public static PointerIconCompat create (Bitmap bitmap, 
                float hotSpotX, 
                float hotSpotY)

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
IllegalArgumentException if bitmap is null, or if the x/y hotspot parameters are invalid.

getSystemIcon

public static PointerIconCompat getSystemIcon (Context context, 
                int style)

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.

Throws
IllegalArgumentException if context is null.

load

public static PointerIconCompat load (Resources resources, 
                int resourceId)

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
IllegalArgumentException if resources is null.
if the resource was not found or the drawable linked in the resource was not found.