【发布时间】:2019-08-23 13:32:23
【问题描述】:
我正在尝试在 Kotlin 中更新我的片段的 TextView。在我的片段的onViewCreated 中声明TextView 时如何更新它?
onViewCreated 函数内部:
val txt = view.findViewById<View>(R.id.txt) as TextView
在另一个函数中:
fun update(){
txt.text= "Hello"
}
【问题讨论】:
-
能分享一下片段代码吗
标签: android kotlin android-context