Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

preview text in textview Android Studio

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?

like image 758
Aksel Willgert Avatar asked Dec 11 '22 21:12

Aksel Willgert


1 Answers

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.

like image 88
laalto Avatar answered Jan 24 '23 01:01

laalto