I have seen many attributes like text
, targetApi
etc in Design
mode of Android Studio
that has the following icon on the left side:
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!!!
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.
that icon is for the tools
namespace. it means that these changes only apply while you are designing your UI in the IDE and will not apply at runtime.
as CommonsWare has said, it's very useful for adding text to components. It's also very useful when designing layouts with several different components which could be hidden or visible
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With