簡體   English   中英

有沒有辦法在 Android Studio 中用字符串替換 TextView 文本?

[英]Is there a way to replace TextView text with a String in Android Studio?

本質上,我試圖用從掃描二維碼獲得的字符串替換 TextView 元素包含的文本,以測試掃描儀是否真正工作

您應該能夠使用 setText 函數編輯文本

public final void setText (CharSequence text)

https://developer.android.com/reference/android/widget/TextView#setText(java.lang.CharSequence)

如果這不能按預期工作,這是一篇非常好的文章(調試您可能會發現 TextView 具有您想要的文本,但尚未顯示在屏幕上):

https://tekeye.uk/android/examples/ui/android-app-text-not-updating

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM