繁体   English   中英

在textview Android Studio中预览文本

[英]preview text in textview Android Studio

在使用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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM