What is the difference between tools: text and android: text in android

I just found out that we can set text using tools: text = "toolsText". before that I used android: text = "androidText".

Please tell me 1. what are the differences between the two features 2. which is the best to use 3. What is the effect during rendering ui

+7
android
source share
1 answer
  • tools:text="toolsText" used only for previewing the layout of Android Studio, it does not display text when the application starts. This is ideal when you do not want to set the text until you perform some calculations, and only then programmatically set the text yourself in your activity, you also want to see the preview layout when writing code in Android Studio, what it will look like when launch the application.
  • android:text="androidText" used to set text to a layout element, textView or button, etc.
+11
source share

All Articles