美文网首页
Kotlin之Fragment

Kotlin之Fragment

作者: 小赵不在 | 来源:发表于2020-10-26 17:14 被阅读0次

    Kotlin中引用控件Id 有两种方法:

    1. onCreateView()
    
     tv_show = view?.findViewById(R.id.tv_show) as TextView.
    
    2.importkotlinx.android.synthetic.main.fragment_home.*
    
    onViewCreated()
    

    推荐第2种,省去了findViewById,节约大量代码

    相关文章

      网友评论

          本文标题:Kotlin之Fragment

          本文链接:https://www.haomeiwen.com/subject/uitzmktx.html