Placeholder text (design process only) in Android layout?

loeschg picture loeschg · Nov 15, 2013 · Viewed 19.4k times · Source

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?

Answer

fantasitcalbeastly picture fantasitcalbeastly · Nov 15, 2013

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=""