![](/img/trans.png)
[英]Android studio - TextView showing on preview but not emulator/device
[英]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.