此Android代码的含义是什么?
*
,+
和空白之间有什么区别:
@*android:id
在android_ics / packages / apps / Setting / res / layout
中是这样的<TextView android:id="@*android:id/timeDisplayForeground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="none"
android:textSize="@dimen/crypt_clock_size"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/crypt_keeper_clock_foreground"
android:layout_alignLeft="@*android:id/timeDisplayBackground"
android:layout_alignTop="@*android:id/timeDisplayBackground"
android:layout_marginBottom="6dip" />
答案 0 :(得分:5)
*允许您访问私人资源。私有资源是私有的,因为他们的名字将来可能会作为固件或皮肤更新的一部分而改变。
使用这些资源并不是一个好主意,除非您在一个环境中工作,在这种情况下,您知道这些资源将来不会发生变化并破坏您的应用。
在您的示例中,系统应用程序正在引用私有资源,您最常见的就是使用此引用。
答案 1 :(得分:1)
@android:id refers to the public system member called "id"
@id refers to one that you've created
@+id says to create one called "id" (and what to set it to)
@*android:id refers to a private system member
请参阅:http://developer.android.com/training/basics/firstapp/building-ui.html