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?
A Placeholder provides a virtual object which can position an existing object. When the id of another view is set on a placeholder (using setContent() ), the placeholder effectively becomes the content view. If the content view exist on the screen it is treated as gone from its original location.
android.widget.Space. Space is a lightweight View subclass that may be used to create gaps between components in general purpose layouts.
Add a text boxClick TextView in the Component Tree panel and then press the Delete key. In the Palette panel, click Text to show the available text controls. Drag the Plain Text into the design editor and drop it near the top of the layout. This is an EditText widget that accepts plain text input.
A text field allows the user to type text into your app. It can be either single line or multi-line. Touching a text field places the cursor and automatically displays the keyboard.
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=""
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