public final class PointerIconCompat extends Object
PointerIcon
introduced after API
level 4 in a backwards compatible fashion.Modifier and Type | Method and Description |
---|---|
static PointerIconCompat |
create(Bitmap bitmap,
float hotSpotX,
float hotSpotY)
Creates a custom pointer from the given bitmap and hotspot information.
|
Object |
getPointerIcon() |
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.
|
public static final int TYPE_NULL
PointerIcon.TYPE_NULL
public static final int TYPE_ARROW
PointerIcon.TYPE_ARROW
public static final int TYPE_CONTEXT_MENU
PointerIcon.TYPE_CONTEXT_MENU
public static final int TYPE_HAND
PointerIcon.TYPE_HAND
public static final int TYPE_HELP
PointerIcon.TYPE_HELP
public static final int TYPE_WAIT
PointerIcon.TYPE_WAIT
public static final int TYPE_CELL
PointerIcon.TYPE_CELL
public static final int TYPE_CROSSHAIR
PointerIcon.TYPE_CROSSHAIR
public static final int TYPE_TEXT
PointerIcon.TYPE_TEXT
public static final int TYPE_VERTICAL_TEXT
PointerIcon.TYPE_VERTICAL_TEXT
public static final int TYPE_ALIAS
PointerIcon.TYPE_ALIAS
public static final int TYPE_COPY
PointerIcon.TYPE_COPY
public static final int TYPE_NO_DROP
PointerIcon.TYPE_NO_DROP
public static final int TYPE_ALL_SCROLL
PointerIcon.TYPE_ALL_SCROLL
public static final int TYPE_HORIZONTAL_DOUBLE_ARROW
PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW
public static final int TYPE_VERTICAL_DOUBLE_ARROW
PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW
public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
public static final int TYPE_ZOOM_IN
PointerIcon.TYPE_ZOOM_IN
public static final int TYPE_ZOOM_OUT
PointerIcon.TYPE_ZOOM_OUT
public static final int TYPE_GRAB
PointerIcon.TYPE_GRAB
public static final int TYPE_GRABBING
PointerIcon.TYPE_GRABBING
public static final int TYPE_DEFAULT
PointerIcon.TYPE_DEFAULT
public Object getPointerIcon()
public static PointerIconCompat getSystemIcon(Context context, int style)
context
- The context.style
- The pointer icon style.IllegalArgumentException
- if context is null.public static PointerIconCompat create(Bitmap bitmap, float hotSpotX, float hotSpotY)
bitmap
- The bitmap for the icon.hotSpotX
- The X offset of the pointer icon hotspot in the bitmap.
Must be within the [0, bitmap.getWidth()) range.hotSpotY
- The Y offset of the pointer icon hotspot in the bitmap.
Must be within the [0, bitmap.getHeight()) range.IllegalArgumentException
- if bitmap is null, or if the x/y hotspot
parameters are invalid.public static PointerIconCompat load(Resources resources, int resourceId)
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" />
resources
- The resources object.resourceId
- The resource id.IllegalArgumentException
- if resources is null.Resources.NotFoundException
- if the resource was not found or the drawable
linked in the resource was not found.