在使用 Android Studio 中的预览工具创建布局时,我一直在使用以下内容。
<TextView
android:id="@+id/my_text_view"
android:text="87%" />
缺点是,如果在实际值可用之前有延迟,UI 会瞬间显示 87%
。
我有什么选择可以很好地处理这个问题?
最佳答案
为了仅供预览,请使用 tools
命名空间:
<TextView
android:id="@+id/my_text_view"
tools:text="87%" />
这样文本只在IDE中显示,在运行时环境中不显示。
在 XML 的根元素中使用 xmlns:tools="http://schemas.android.com/tools"
声明 tools
。
关于android - 在 textview Android Studio 中预览文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32628448/