Kotlin synthetic in Adapter or ViewHolder

前端 未结 7 643
孤独总比滥情好
孤独总比滥情好 2020-12-13 05:36

I am new in kotlin. I have found and tried to use synthetic method instead of annoying method findViewById in my Activity class, but I have found \

7条回答
  •  自闭症患者
    2020-12-13 05:56

    You need

    import kotlinx.android.synthetic.row_wall.view.*
    

    And later something along the lines of:

    convertView.titleText.text = item.title
    

    The point is that the view.* introduces extensions to the View class.

提交回复
热议问题