@android 的含义 [英] The meaning of @android

查看:31
本文介绍了@android 的含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下@androidandroid:id="@android:id/list中是什么意思.我在不同的android中见过示例和教程,我也用谷歌搜索过.我发现的唯一解释是Android 平台为我们提供了列表和空 ID,因此,我们必须在 ID 前加上 android:"来自 http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html

I would like to ask what is the meaning of @android as in android:id="@android:id/list. I have seen it in different android samples and tutorials, and I have also googled it. The only explanation I found is "The list and empty IDs are provided for us by the Android platform, so, we must prefix the id with android:" from http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html

谢谢.

推荐答案

安卓:

包含平台中包含的应用程序使用的资源类,并定义系统功能的应用程序权限.

您可以在自己的应用程序中直接使用这些 R 类中的一些资源,但通常您应该只使用您在应用程序中直接提供的资源,以便提供一个没有外部依赖的内聚应用程序包.特别是,您不应使用 android 包中的可绘制资源,因为它们可能会在平台版本之间发生变化,从而导致与您的设计发生不可预见的冲突.通常,样式是您应该直接从这些资源中使用的唯一资源.

You can use some resources directly from these R classes in your own applications, but you should generally use only resources that you've provided directly in your application, in order to provide a cohesive application package that has no external dependencies. In particular, you should not use drawable resources from the android package, because they may change between platform versions, causing unforeseen conflicts with your design. Typically, styles are the only resources you should use directly from these resources.

因此,您正在使用 android 的资源,如列表、空等.通过在 xml 文件中使用@android:id".

So you are using android' resources like list, empty etc.. by using '@android:id' in xml file.

@+id 和@android:id 的区别:

@+id/foo means you are creating an id named foo in the namespace of
your application. You can refer to it using @id/foo. @android:id/foo
means you are referring to an id defined in the android namespace.
This namespace is the namespace of the framework. In this case, you
need to use @android:id/list and @android:id/empty because these are
the id the framework expects to find (the framework knows only about
the ids in the android namespace.

谢谢.

这篇关于@android 的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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