来自 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/