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.
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
|
int TYPE_CONTEXT_MENU
Synonym for TYPE_CONTEXT_MENU
Constant Value: 1001 (0x000003e9)
int TYPE_HORIZONTAL_DOUBLE_ARROW
Synonym for TYPE_HORIZONTAL_DOUBLE_ARROW
Constant Value: 1014 (0x000003f6)
int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
Synonym for TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
Constant Value: 1017 (0x000003f9)
int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
Synonym for TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
Constant Value: 1016 (0x000003f8)
int TYPE_VERTICAL_DOUBLE_ARROW
Synonym for TYPE_VERTICAL_DOUBLE_ARROW
Constant Value: 1015 (0x000003f7)
int TYPE_VERTICAL_TEXT
Synonym for TYPE_VERTICAL_TEXT
Constant Value: 1009 (0x000003f1)
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. |
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. |
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. |