-
public final class PointerIconCompat
Helper for accessing features in PointerIcon in a backwards compatible fashion.
-
-
Field Summary
Fields Modifier and Type Field Description public final static int
TYPE_NULL
public final static int
TYPE_ARROW
public final static int
TYPE_CONTEXT_MENU
public final static int
TYPE_HAND
public final static int
TYPE_HELP
public final static int
TYPE_WAIT
public final static int
TYPE_CELL
public final static int
TYPE_CROSSHAIR
public final static int
TYPE_TEXT
public final static int
TYPE_VERTICAL_TEXT
public final static int
TYPE_ALIAS
public final static int
TYPE_COPY
public final static int
TYPE_NO_DROP
public final static int
TYPE_ALL_SCROLL
public final static int
TYPE_HORIZONTAL_DOUBLE_ARROW
public final static int
TYPE_VERTICAL_DOUBLE_ARROW
public final static int
TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
public final static int
TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
public final static int
TYPE_ZOOM_IN
public final static int
TYPE_ZOOM_OUT
public final static int
TYPE_GRAB
public final static int
TYPE_GRABBING
public final static int
TYPE_DEFAULT
-
Method Summary
Modifier and Type Method Description Object
getPointerIcon()
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. static PointerIconCompat
create(Bitmap bitmap, float hotSpotX, float hotSpotY)
Creates a custom pointer from the given bitmap and hotspot information. static PointerIconCompat
load(Resources resources, int resourceId)
Loads a custom pointer icon from an XML resource. -
-
Method Detail
-
getPointerIcon
Object getPointerIcon()
-
getSystemIcon
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
- The context.style
- The pointer icon style.
-
create
static PointerIconCompat create(Bitmap bitmap, float hotSpotX, float hotSpotY)
Creates a custom pointer from the given bitmap and hotspot information.
- Parameters:
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.
-
load
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
- The resources object.resourceId
- The resource id.
-
-
-
-