简体   繁体   中英

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

本质上,我试图用从扫描二维码获得的字符串替换 TextView 元素包含的文本,以测试扫描仪是否真正工作

You should be able to edit the text with the setText function

public final void setText (CharSequence text)

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

and here's a really nice article if that doesn't work as expected (debugging you may find that the TextView has the text you want, but is not displayed on the screen yet):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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