什么" @ + ID"意味着?QUOT、ID

由网友(这年头,感情全是走私货)分享简介:我已经通过很多Android的文档的阅读,我还没有找到任何声明,说什么@ +编号的意思id值preFIX。我知道什么是@string,并且平均变化,但不能用+的变化。除了给我的答案,你能告诉我在哪里,在Android文档,这是记录?I've read through much of the Android docum...

我已经通过很多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

阅读全文

相关推荐

最新文章