Is there a way to have text displayed in the preview pane in Android studio but not in the actual app while running on the phone?
I currently use the android:hint
attribute, which is quite useful to see how much space a TextView
requires or what size the text will be.
The problem, however, is that in case no text is assigned to the TextView
, the hint shows in the app.
Is there a way to have the text display only in android studio but not at runtime?
It's tools:text="some text"
. This only will be visible in Android Studio.
From docs:
You can insert sample data in your layout preview by using the tools: prefix instead of android: with any attribute from the Android framework. This is useful when the attribute's value isn't populated until runtime but you want to see the effect beforehand, in the layout preview.
For example, if the android:text attribute value is set at runtime or you want to see the layout with a value different than the default, you can add tools:text to specify some text for the layout preview only.
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