" @ ID / Android的:清单"与" @android:ID /表"在Android的布局XML [英] "@id/android:list" vs. "@android:id/list" in Android Layout XML

查看:127
本文介绍了" @ ID / Android的:清单"与" @android:ID /表"在Android的布局XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的自己的文档,并在我继承了应用程序,我有时会看到的表单视图的ID

In Android's own docs, and in the app I inherited, I sometimes see view IDs with the form

"@id/android:list"

和有时的形式

"@android:id/list"

这就是机器人:有时来自bewteen@和身份证,有时来/与实际ID之间

That is, "android:" sometimes comes bewteen "@" and "id", and sometimes comes between "/" and the actual ID.

什么是这两种形式的含义?他们是等价?

What are the meanings of those two forms? Are they equivalent?

推荐答案

在功能我相信在两者equivlant并且都将寻找android.R.id.list。 他们只是说以不同的方式同样的事情。

Functionally I belive the the two are equivlant and will both look for android.R.id.list. They are just saying the same thing in a different way.

资源是特定的包。话说@ ID / Android的:清单将寻找Android包内的列表ID。在这个版本中,你正在寻找在包中所指出的:。在第二个例子@android:ID /列表中,您首先定义了包,Android包,然后告诉它查找该包内的身份证/列表。

Resources in android are package specific. Saying @id/android:list will look for the list id within the android package. In this version, the package you are looking in is indicated by the :. In the second example @android:id/list you are defining the package first, the android package, and then telling it to look for id/list within that package.

这只是工作,因为这将是你说@字符串/不管或@ ID /等等。在这种情况下,系统会看在你的应用程序包的资源。通过首先将机器人,你只是告诉它看在Android包这些资源,而不是在自己的应用程序的资源文件夹。

This works just as it would were you to say @string/whatever or @id/blah. In those instances the system would look within your applications package for that resource. By placing android first, you're just telling it to look in the android package for those resources and not within your own applications resources folder.

我觉得<一个href="http://stackoverflow.com/questions/4355614/what-is-difference-between-id-androidlist-and-id-list">this帖子也回答了你的问题。它有一些更详细的评论,以及可能会有所帮助。

I think this post also answers your question. It has some more detailed comments as well that might be helpful.

这篇关于&QUOT; @ ID / Android的:清单&QUOT;与&QUOT; @android:ID /表&QUOT;在Android的布局XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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