Most visited

Recently visited

Added in API level 18

WindowId

public class WindowId
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.WindowId


窗口的安全标识符。 这目前允许您检索并观察窗口的输入焦点状态。 大多数应用程序不会使用它,而是依靠View上提供的更简单(更高效)的方法。 当需要跨进程完成窗口输入交互时,这些类很有用:类本身是一个Parcelable,可以将其传递给其他进程以供它们与窗口交互,并且它提供了一个有限的安全API,它不允许其他进程过程负面伤害你的窗户。

Summary

Nested classes

class WindowId.FocusObserver

用于观察WindowId焦点状态变化的子类。

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<WindowId> CREATOR

Public methods

int describeContents()

描述此Parcelable实例的封送表示中包含的特殊对象的种类。

boolean equals(Object otherObj)

两个IntentSender对象的比较运算符,例如返回true,然后它们表示来自同一个包的相同操作。

int hashCode()

返回对象的哈希码值。

boolean isFocused()

检索关联窗口的当前焦点状态。

void registerFocusObserver(WindowId.FocusObserver observer)

开始监视窗口焦点状态的变化。

String toString()

返回对象的字符串表示形式。

void unregisterFocusObserver(WindowId.FocusObserver observer)

停止监视窗口焦点状态的变化。

void writeToParcel(Parcel out, int flags)

将此对象平铺到一个包裹中。

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Fields

CREATOR

Added in API level 18
Creator<WindowId> CREATOR

Public methods

describeContents

Added in API level 18
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.

equals

Added in API level 18
boolean equals (Object otherObj)

两个IntentSender对象的比较运算符,例如返回true,然后它们表示来自同一个包的相同操作。

Parameters
otherObj Object: the reference object with which to compare.
Returns
boolean true if this object is the same as the obj argument; false otherwise.

hashCode

Added in API level 18
int hashCode ()

返回对象的哈希码值。 为了散列表的好处而支持该方法,例如由HashMap提供的HashMap

一般合约 hashCode是:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

尽可能合理实用,由类Object定义的hashCode方法确实为不同的对象返回不同的整数。 (这通常通过将对象的内部地址转换为整数来实现,但Java TM编程语言不需要此实现技术。)

Returns
int a hash code value for this object.

isFocused

Added in API level 18
boolean isFocused ()

检索关联窗口的当前焦点状态。

Returns
boolean

registerFocusObserver

Added in API level 18
void registerFocusObserver (WindowId.FocusObserver observer)

开始监视窗口焦点状态的变化。

Parameters
observer WindowId.FocusObserver

toString

Added in API level 18
String toString ()

返回对象的字符串表示形式。 一般来说, toString方法返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。

ObjecttoString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

unregisterFocusObserver

Added in API level 18
void unregisterFocusObserver (WindowId.FocusObserver observer)

停止监视窗口焦点状态的变化。

Parameters
observer WindowId.FocusObserver

writeToParcel

Added in API level 18
void writeToParcel (Parcel out, 
                int flags)

将此对象平铺到一个包裹中。

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.

Hooray!