android - @ 在 AndroidManifest.xml 文件中

标签 android xml

来自 Rick Rogers、John Lombardo、Zigurd Mednieks 和 Blake Meike 的 O'Reilly 著作“Android 应用程序开发”,第 23 页:

 <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    />

从第 44 页开始:

 <application android:icon="@drawable/icon2">

以上每个 fragment 中的@是什么意思?

最佳答案

在这种情况下:

android:layout_width="fill_parent"

android:layout_width 属性的值直接在引号 fill_parent 内指定。在另一种情况下:

android:text="@string/hello"

android:text="@string/hello" 属性的值在别处指定。这由字符串开头的 @ 指示。在此示例中,它是 @string/hello。值在资源中。

来自 The AndroidManifest.xml File 中的“资源值”部分来自 Android 开发者网站。从 allclaws 中的链接找到回答。

Resource values are expressed in the following format,

@[package:]type:name

where the package name can be omitted if the resource is in the same package as the application, type is a type of resource — such as "string" or "drawable" — and name is the name that identifies the specific resource.

关于android - @ 在 AndroidManifest.xml 文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1018392/

相关文章:

Android TableLayout - 跨越两行的跨度元素

android - 为什么intellij必须为我制作的每个android项目安装不同的gradle版本

android - 将值传递给另一个 Activity

java - RSS 项目顺序,重要吗?

java.lang.NoSuchMethodError : org. apache.xml.security.transforms.Transform.init()V

xml - 测试 Atom 服务器的最佳方法是什么?

php - 如何使用 jQuery 或 PHP 制作网页输出 XML?

android - 如何避免本地 Web 应用程序数据被删除?

java - 数学 pow 返回 1.0

android - 四个圆角不同颜色的按钮