Search code examples
androidandroid-studioandroid-attributes

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


I have seen many attributes like text, targetApi etc in Design mode of Android Studio that has the following icon on the left side:

enter image description here

Some of them are more than once for example one text attribute without wrench icon and one with wrench icon. What is the purpose and use? Any examples would be appreciated. Thanks!!!


Solution

  • The one with the wrench icon controls the tools: attribute, whereas the one without the wrench controls an android: or app: attribute. Attributes in the tools: namespace are only used by development tools and have no runtime effects. So, tools:text says "show this text in this widget in the IDE", while android:text says "show this text in this widget on the device". This is particularly useful in cases where you cannot provide android:text, as the text is not knowable until the app runs — tools:text lets you provide sample text to help with setting up the UI design.