Android Studio - 带有扳手图标的属性有什么用?

Android Studio - What is the use of attributes having the wrench icon?

我在 Android StudioDesign 模式下看到许多属性,例如 texttargetApi 等,左侧有以下图标:

其中一些不止一次,例如一个 text 属性没有扳手图标,一个有扳手图标。目的和用途是什么?任何例子将不胜感激。谢谢!!!

带扳手图标的控制 tools: 属性,而没有扳手图标的控制 android:app: 属性。 tools: 命名空间中的属性仅供开发工具使用,没有运行时效果。因此,tools:text 表示 "show this text in this widget in the IDE",而 android:text 表示 "show this text in this widget on the device"。这在您无法提供 android:text 的情况下特别有用,因为在应用程序运行之前文本是不可知的 — tools:text 允许您提供示例文本以帮助设置 UI 设计。

该图标用于 tools 命名空间。这意味着这些更改仅在您在 IDE 中设计 UI 时适用,不会在运行时应用。

正如 CommonsWare 所说,它对于向组件添加文本非常有用。在设计具有多个可能隐藏或可见的不同组件的布局时,它也非常有用