什么是指到Android XML资源时,星号(*)的含义? [英] What is the meaning of the asterisk (*) when referring to Android XML resources?

查看:165
本文介绍了什么是指到Android XML资源时,星号(*)的含义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是这款Android code是什么意思?

之间的区别是什么 * + 空:

  @ *机器人:ID
 

这样的android_ics /封装/应用程序/设置/ RES /布局

 < TextView的机器人:ID =@ *机器人:ID / timeDisplayForeground
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:单线=真
    机器人:ellipsize =无
    机器人:TEXTSIZE =@扪/ crypt_clock_size
    机器人:textAppearance =机器人:ATTR / textAppearanceMedium
    机器人:文字颜色=@色/ crypt_keeper_clock_foreground
    机器人:layout_alignLeft =@ *机器人:ID / timeDisplayBackground
    机器人:layout_alignTop =@ *机器人:ID / timeDisplayBackground
    机器人:layout_marginBottom =6dip/>
 

解决方案

中的*允许您访问私有资源。私人资源是私人的一个原因是他们的名字可能会在未来改变,因为固件或皮肤更新的一部分。

这不是利用这些资源,除非你的工作在你知道这些资源不会改变,打破您在未来的应用程序的环境中是一个好主意。

在你的榜样,私人资源正在由系统应用程序,它是在那里你会发现大多数情况下这种*参考使用引用。

What is the meaning of this Android code?

What is the difference between * ,+ and empty:

@*android:id

like this in 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" />

解决方案

The * allows you to access private resources. Private resources are private for a reason as their name could change in the future as part of a firmware or skin update.

It's not a good idea to use these resources unless you're working in an environment where you know these resources won't change and break your app in the future.

In your example, the private resources are being referenced by a system app which is where you'll most commonly see this * referencing used.

这篇关于什么是指到Android XML资源时,星号(*)的含义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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