gpt4 book ai didi

android - 小部件类型旁边的字母数字是什么?

转载 作者:行者123 更新时间:2023-11-29 23:49:00 26 4
gpt4 key购买 nike

在 android studio 控制台中,小部件旁边有字母数字编号。例如,android.view.inputmethod.EditorInfo@3afd2

这里的“3afd2”是什么意思?它可以用来查找小部件的ID吗?PS:刚接触android和stackoverflow。

最佳答案

该字符串看起来像 toString 方法的默认实现(在 Object 类中)的返回值。根据docs , toString 方法:

returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object.

基本上,您在 @ 之后看到的数字是小部件对象的哈希码。您不能使用哈希码来查找小部件的 ID(另外,EditorInfo 不是小部件)。哈希码仅设计为单向的。您可以在其 documentation page 上阅读有关 hashCode 契约(Contract)的更多信息。 .

关于android - 小部件类型旁边的字母数字是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51113542/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com