Skip to content

Most visited

Recently visited

navigation

PointerIconCompat

public final class PointerIconCompat
extends Object

java.lang.Object
   ↳ android.support.v4.view.PointerIconCompat


Helper for accessing features in PointerIcon introduced after API level 4 in a backwards compatible fashion.

Summary

Constants

int TYPE_ALIAS

Synonym for TYPE_ALIAS

int TYPE_ALL_SCROLL

Synonym for TYPE_ALL_SCROLL

int TYPE_ARROW

Synonym for TYPE_ARROW

int TYPE_CELL

Synonym for TYPE_CELL

int TYPE_CONTEXT_MENU

Synonym for TYPE_CONTEXT_MENU

int TYPE_COPY

Synonym for TYPE_COPY

int TYPE_CROSSHAIR

Synonym for TYPE_CROSSHAIR

int TYPE_DEFAULT

Synonym for TYPE_DEFAULT

int TYPE_GRAB

Synonym for TYPE_GRAB

int TYPE_GRABBING

Synonym for TYPE_GRABBING

int TYPE_HAND

Synonym for TYPE_HAND

int TYPE_HELP

Synonym for TYPE_HELP

int TYPE_HORIZONTAL_DOUBLE_ARROW

Synonym for TYPE_HORIZONTAL_DOUBLE_ARROW

int TYPE_NO_DROP

Synonym for TYPE_NO_DROP

int TYPE_NULL

Synonym for TYPE_NULL

int TYPE_TEXT

Synonym for TYPE_TEXT

int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Synonym for TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Synonym for TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

int TYPE_VERTICAL_DOUBLE_ARROW

Synonym for TYPE_VERTICAL_DOUBLE_ARROW

int TYPE_VERTICAL_TEXT

Synonym for TYPE_VERTICAL_TEXT

int TYPE_WAIT

Synonym for TYPE_WAIT

int TYPE_ZOOM_IN

Synonym for TYPE_ZOOM_IN

int TYPE_ZOOM_OUT

Synonym for 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

From class java.lang.Object

Constants

TYPE_ALIAS

added in version 24.0.0
int TYPE_ALIAS

Synonym for TYPE_ALIAS

Constant Value: 1010 (0x000003f2)

TYPE_ALL_SCROLL

added in version 24.0.0
int TYPE_ALL_SCROLL

Synonym for TYPE_ALL_SCROLL

Constant Value: 1013 (0x000003f5)

TYPE_ARROW

added in version 24.0.0
int TYPE_ARROW

Synonym for TYPE_ARROW

Constant Value: 1000 (0x000003e8)

TYPE_CELL

added in version 24.0.0
int TYPE_CELL

Synonym for TYPE_CELL

Constant Value: 1006 (0x000003ee)

TYPE_CONTEXT_MENU

added in version 24.0.0
int TYPE_CONTEXT_MENU

Synonym for TYPE_CONTEXT_MENU

Constant Value: 1001 (0x000003e9)

TYPE_COPY

added in version 24.0.0
int TYPE_COPY

Synonym for TYPE_COPY

Constant Value: 1011 (0x000003f3)

TYPE_CROSSHAIR

added in version 24.0.0
int TYPE_CROSSHAIR

Synonym for TYPE_CROSSHAIR

Constant Value: 1007 (0x000003ef)

TYPE_DEFAULT

added in version 24.0.0
int TYPE_DEFAULT

Synonym for TYPE_DEFAULT

Constant Value: 1000 (0x000003e8)

TYPE_GRAB

added in version 24.0.0
int TYPE_GRAB

Synonym for TYPE_GRAB

Constant Value: 1020 (0x000003fc)

TYPE_GRABBING

added in version 24.0.0
int TYPE_GRABBING

Synonym for TYPE_GRABBING

Constant Value: 1021 (0x000003fd)

TYPE_HAND

added in version 24.0.0
int TYPE_HAND

Synonym for TYPE_HAND

Constant Value: 1002 (0x000003ea)

TYPE_HELP

added in version 24.0.0
int TYPE_HELP

Synonym for TYPE_HELP

Constant Value: 1003 (0x000003eb)

TYPE_HORIZONTAL_DOUBLE_ARROW

added in version 24.0.0
int TYPE_HORIZONTAL_DOUBLE_ARROW

Synonym for TYPE_HORIZONTAL_DOUBLE_ARROW

Constant Value: 1014 (0x000003f6)

TYPE_NO_DROP

added in version 24.0.0
int TYPE_NO_DROP

Synonym for TYPE_NO_DROP

Constant Value: 1012 (0x000003f4)

TYPE_NULL

added in version 24.0.0
int TYPE_NULL

Synonym for TYPE_NULL

Constant Value: 0 (0x00000000)

TYPE_TEXT

added in version 24.0.0
int TYPE_TEXT

Synonym for TYPE_TEXT

Constant Value: 1008 (0x000003f0)

TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

added in version 24.0.0
int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Synonym for TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW

Constant Value: 1017 (0x000003f9)

TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

added in version 24.0.0
int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Synonym for TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW

Constant Value: 1016 (0x000003f8)

TYPE_VERTICAL_DOUBLE_ARROW

added in version 24.0.0
int TYPE_VERTICAL_DOUBLE_ARROW

Synonym for TYPE_VERTICAL_DOUBLE_ARROW

Constant Value: 1015 (0x000003f7)

TYPE_VERTICAL_TEXT

added in version 24.0.0
int TYPE_VERTICAL_TEXT

Synonym for TYPE_VERTICAL_TEXT

Constant Value: 1009 (0x000003f1)

TYPE_WAIT

added in version 24.0.0
int TYPE_WAIT

Synonym for TYPE_WAIT

Constant Value: 1004 (0x000003ec)

TYPE_ZOOM_IN

added in version 24.0.0
int TYPE_ZOOM_IN

Synonym for TYPE_ZOOM_IN

Constant Value: 1018 (0x000003fa)

TYPE_ZOOM_OUT

added in version 24.0.0
int TYPE_ZOOM_OUT

Synonym for TYPE_ZOOM_OUT

Constant Value: 1019 (0x000003fb)

Public methods

create

added in version 24.0.0
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

added in version 24.0.0
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

added in version 24.0.0
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.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.