I've been using the following when creating layouts using the preview tool in Android Studio.
<TextView
android:id="@+id/my_text_view"
android:text="87%" />
The drawback is, if there is a delay before the real value is available, the UI will show 87% for a split second.
What are my options to handle this nicely?
For preview-only purposes, use the tools namespace:
<TextView
android:id="@+id/my_text_view"
tools:text="87%" />
This way the text only shows in IDE but not in runtime environment.
Declare tools with xmlns:tools="http://schemas.android.com/tools" in your XML's root element.
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