If you have ever entered some testing text in a TextView to see how it looks in the previewer, then this is for you.
For any attribute in the xml that has the pattern ‘android:something=”value”‘, you can add a new attribute named
tools:something=”value” and it will be picked up by the previewer but ignored in your app. Then you can leave default values that makes sense to visualize the layout without impacting the final build.
Two things that you should check using the tools namespace:
1) Text that will be set at runtime (so that you don’t try to visualize an empty layout)
2) Stuff that is dynamically changed later (e.g. visibility)
To configure the tools namespace, put this in the root tag of your layout (under the android xmlns):