Question

Is it possible to create placeholder text that is only visible during the layout design process in Android Studio?

For example, say I have 2 TextViews in a linear layout that are going to be dynamically populated. During the design phase, I use placeholder text to ensure I get padding and such correct. I often forget to remove placeholder text, so during loading of the new data, the old data will appear for a split second... looks tacky.

It would be cool if there was a field similar to android:placeholderText="This is placeholder text" that would only display in the preview. There isn't such a thing that I've happened to have missed is there?

Was it helpful?

Solution

Yes it is (these days), and I believe that this is probably what you're looking for:
https://developer.android.com/studio/write/tool-attributes - specifically: tools:text=""

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top