Android XML属性中的星号(*) [英] Asterisk (*) in Android XML attributes

查看:163
本文介绍了Android XML属性中的星号(*)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以在Android XML属性中解释星号的意思吗?

Can anyone explain the asterisk means in Android XML attributes?

<style name="DocumentsTheme" parent="@style/DialogWhenReallyLarge">
    <item name="android:actionBarTheme">@*android:style/ThemeOverlay.Material.Dark.ActionBar</item>
    <item name="*android:windowFixedWidthMajor">@null</item>
</style>

推荐答案

*允许您访问私有资源.私有资源之所以是私有的,是因为其名称将来可能会作为固件或外观更新的一部分而更改.

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: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

这篇关于Android XML属性中的星号(*)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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