public
final
class
PointerIcon
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.view.PointerIcon |
Represents an icon that can be used as a mouse pointer.
Pointer icons can be provided either by the system using system types, or by applications using bitmaps or application resources.
Constants | |
---|---|
int |
TYPE_ALIAS
Type constant: alias (indicating an alias of/shortcut to something is to be created. |
int |
TYPE_ALL_SCROLL
Type constant: all-scroll. |
int |
TYPE_ARROW
Type constant: Arrow icon. |
int |
TYPE_CELL
Type constant: cell. |
int |
TYPE_CONTEXT_MENU
Type constant: context-menu. |
int |
TYPE_COPY
Type constant: copy. |
int |
TYPE_CROSSHAIR
Type constant: crosshair. |
int |
TYPE_DEFAULT
The default pointer icon. |
int |
TYPE_GRAB
Type constant: grab. |
int |
TYPE_GRABBING
Type constant: grabbing. |
int |
TYPE_HAND
Type constant: hand. |
int |
TYPE_HELP
Type constant: help. |
int |
TYPE_HORIZONTAL_DOUBLE_ARROW
Type constant: horizontal double arrow mainly for resizing. |
int |
TYPE_NO_DROP
Type constant: no-drop. |
int |
TYPE_NULL
Type constant: Null icon. |
int |
TYPE_TEXT
Type constant: text. |
int |
TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-left to bottom-right. |
int |
TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-right to bottom-left. |
int |
TYPE_VERTICAL_DOUBLE_ARROW
Type constant: vertical double arrow mainly for resizing. |
int |
TYPE_VERTICAL_TEXT
Type constant: vertical-text. |
int |
TYPE_WAIT
Type constant: wait. |
int |
TYPE_ZOOM_IN
Type constant: zoom-in. |
int |
TYPE_ZOOM_OUT
Type constant: zoom-out. |
Inherited constants |
---|
From
interface
android.os.Parcelable
|
Fields | |
---|---|
public
static
final
Creator<PointerIcon> |
CREATOR
|
Public methods | |
---|---|
static
PointerIcon
|
create(Bitmap bitmap, float hotSpotX, float hotSpotY)
Creates a custom pointer icon from the given bitmap and hotspot information. |
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
boolean
|
equals(Object other)
Indicates whether some other object is "equal to" this one. |
static
PointerIcon
|
getSystemIcon(Context context, int type)
Gets a system pointer icon for the given type. |
static
PointerIcon
|
load(Resources resources, int resourceId)
Loads a custom pointer icon from an XML resource. |
void
|
writeToParcel(Parcel out, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
From
class
java.lang.Object
| |
From
interface
android.os.Parcelable
|
int TYPE_ALIAS
Type constant: alias (indicating an alias of/shortcut to something is to be created.
Constant Value: 1010 (0x000003f2)
int TYPE_ALL_SCROLL
Type constant: all-scroll.
Constant Value: 1013 (0x000003f5)
int TYPE_ARROW
Type constant: Arrow icon. (Default mouse pointer)
Constant Value: 1000 (0x000003e8)
int TYPE_CELL
Type constant: cell.
Constant Value: 1006 (0x000003ee)
int TYPE_CONTEXT_MENU
Type constant: context-menu.
Constant Value: 1001 (0x000003e9)
int TYPE_COPY
Type constant: copy.
Constant Value: 1011 (0x000003f3)
int TYPE_CROSSHAIR
Type constant: crosshair.
Constant Value: 1007 (0x000003ef)
int TYPE_DEFAULT
The default pointer icon.
Constant Value: 1000 (0x000003e8)
int TYPE_GRAB
Type constant: grab.
Constant Value: 1020 (0x000003fc)
int TYPE_GRABBING
Type constant: grabbing.
Constant Value: 1021 (0x000003fd)
int TYPE_HAND
Type constant: hand.
Constant Value: 1002 (0x000003ea)
int TYPE_HELP
Type constant: help.
Constant Value: 1003 (0x000003eb)
int TYPE_HORIZONTAL_DOUBLE_ARROW
Type constant: horizontal double arrow mainly for resizing.
Constant Value: 1014 (0x000003f6)
int TYPE_NO_DROP
Type constant: no-drop.
Constant Value: 1012 (0x000003f4)
int TYPE_NULL
Type constant: Null icon. It has no bitmap.
Constant Value: 0 (0x00000000)
int TYPE_TEXT
Type constant: text.
Constant Value: 1008 (0x000003f0)
int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-left to bottom-right.
Constant Value: 1017 (0x000003f9)
int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW
Type constant: diagonal double arrow -- top-right to bottom-left.
Constant Value: 1016 (0x000003f8)
int TYPE_VERTICAL_DOUBLE_ARROW
Type constant: vertical double arrow mainly for resizing.
Constant Value: 1015 (0x000003f7)
int TYPE_VERTICAL_TEXT
Type constant: vertical-text.
Constant Value: 1009 (0x000003f1)
int TYPE_WAIT
Type constant: wait.
Constant Value: 1004 (0x000003ec)
int TYPE_ZOOM_IN
Type constant: zoom-in.
Constant Value: 1018 (0x000003fa)
int TYPE_ZOOM_OUT
Type constant: zoom-out.
Constant Value: 1019 (0x000003fb)
PointerIcon create (Bitmap bitmap, float hotSpotX, float hotSpotY)
Creates a custom pointer icon 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 | |
---|---|
PointerIcon |
A pointer icon for this bitmap. |
Throws | |
---|---|
IllegalArgumentException |
if bitmap is null, or if the x/y hotspot parameters are invalid. |
int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
boolean equals (Object other)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
Parameters | |
---|---|
other |
Object :
the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
PointerIcon getSystemIcon (Context context, int type)
Gets a system pointer icon for the given type. If typeis not recognized, returns the default pointer icon.
Parameters | |
---|---|
context |
Context :
The context. |
type |
int :
The pointer icon type. |
Returns | |
---|---|
PointerIcon |
The pointer icon. |
Throws | |
---|---|
IllegalArgumentException |
if context is null. |
PointerIcon 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 | |
---|---|
PointerIcon |
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. |
void writeToParcel (Parcel out, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
out |
Parcel :
The Parcel in which the object should be written. |
flags |
int :
Additional flags about how the object should be written.
May be 0 or PARCELABLE_WRITE_RETURN_VALUE .
|