public abstract class InputEvent
extends Object implements Parcelable
| java.lang.Object | |
| android.view.InputEvent | |
| |
输入事件的通用基类。
Inherited constants |
|---|
android.os.Parcelable
|
Fields |
|
|---|---|
public static final Creator<InputEvent> |
CREATOR |
公共方法(Public methods) |
|
|---|---|
int |
describeContents() 描述此Parcelable实例的封送表示中包含的特殊对象的种类。 |
final InputDevice |
getDevice() 获取此事件来自的设备。 |
abstract int |
getDeviceId() 获取此事件来自的设备的ID。 |
abstract long |
getEventTime() 检索此事件发生的时间,在 |
abstract int |
getSource() 获取事件的来源。 |
boolean |
isFromSource(int source) 确定事件是否来自给定源。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
android.os.Parcelable
|
|
int describeContents ()
描述此Parcelable实例的封送表示中包含的特殊对象的种类。 例如,如果对象在writeToParcel(Parcel, int)的输出中包含writeToParcel(Parcel, int) ,则此方法的返回值必须包含CONTENTS_FILE_DESCRIPTOR位。
| 返回(Returns) | |
|---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
InputDevice getDevice ()
获取此事件来自的设备。
| 返回(Returns) | |
|---|---|
InputDevice |
The device, or null if unknown. |
int getDeviceId ()
获取此事件来自的设备的ID。 ID为0表示事件不是来自物理设备,而是映射到默认键盘映射。 其他数字是任意的,你不应该依赖于这些值。
| 返回(Returns) | |
|---|---|
int |
The device id. |
也可以看看:
long getEventTime ()
检索此事件发生的时间,在 uptimeMillis()时基中。
| 返回(Returns) | |
|---|---|
long |
Returns the time this event occurred, in the uptimeMillis() time base. |
int getSource ()
获取事件的来源。
| 返回(Returns) | |
|---|---|
int |
The event source or SOURCE_UNKNOWN if unknown. |
也可以看看:
boolean isFromSource (int source)
确定事件是否来自给定源。
| 参数(Parameters) | |
|---|---|
source |
int: The input source to check against. This can be a specific device type, such as SOURCE_TOUCH_NAVIGATION, or a more generic device class, such as SOURCE_CLASS_POINTER. |
| 返回(Returns) | |
|---|---|
boolean |
Whether the event is from the given source. |