什么" @ + ID"意味着? [英] What does "@+id" mean?

查看:130
本文介绍了什么" @ + ID"意味着?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过很多Android的文档的阅读,我还没有找到任何声明,说什么@ +编号的意思id值preFIX。我知道什么是@string,并且平均变化,但不能用+的变化。除了给我的答案,你能告诉我在哪里,在Android文档,这是记录?

I've read through much of the Android documentation and I've yet to find any statement that says what an id value prefix of "@+id" means. I know what "@string" and variations of that mean, but not the variation with the "+". Besides giving me the answer, can you show me where in the Android docs this is documented?

推荐答案

加号简单地表示该ID应被创建,如果它不存在

The plus sign simply indicates that the ID should be created if it doesn't exist.

这是通常的做法是使用 @ + ID /富确定在布局中一个新的视图时,然后用 @ ID /富引用视图从布局的另一部分(比如,在一个RelativeLayout的层次结构)或 R.id.foo 从code引用它

It's common practice to use @+id/foo when defining a new View in a layout, and then use @id/foo to reference the View from another part of the layout (say, in a RelativeLayout hierarchy) or R.id.foo to reference it from code.

更新:文档是在这里:声明布局 - 属性 - ID

这篇关于什么" @ + ID"意味着?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆