Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placeholder text (design process only) in Android layout?

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?

like image 587
loeschg Avatar asked Nov 15 '13 17:11

loeschg


People also ask

What is a placeholder in Android?

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.

What is space layout in Android?

android.widget.Space. Space is a lightweight View subclass that may be used to create gaps between components in general purpose layouts.

How do you add a textbox on Android?

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.

What is text fields in Android?

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.


1 Answers

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

like image 158
fantasitcalbeast Avatar answered Nov 16 '22 02:11

fantasitcalbeast