gpt4 book ai didi

android - "@+id/idname"格式的@在android中是什么意思?

转载 作者:行者123 更新时间:2023-11-29 15:12:55 25 4
gpt4 key购买 nike

official link here

他们说:

The at sign (@) is required when you're referring to any resource object from XML. It is followed by the resource type (id in this case), a slash, then the resource name (edit_message).

不太明白@是什么意思,谁能给个更具体的解释?

最佳答案

如果 ID 尚未创建,则 +创建它。只有在第一次引用该 ID 时才需要它。

来自文档:

The plus sign (+) before the resource type is needed only when you're defining a resource ID for the first time. When you compile the app, the SDK tools use the ID name to create a new resource ID in your project's gen/R.java file that refers to the EditText element. With the resource ID declared once this way, other references to the ID do not need the plus sign.

如文档所述,@ 符号表示您正在引用 xml 资源。例如:@string/edit_message 表示您正在尝试引用一个在 xml 文件中定义了 id edit_message 的字符串。

关于android - "@+id/idname"格式的@在android中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28599828/

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