Kotlin-Not enough information to infer parameter T in fun<T:View> findViewById(id: Int): T!

来源:互联网 发布:wiki.apache.org 编辑:程序博客网 时间:2024/06/07 22:02
错误:

Type inference failed : Not enough information to infer parameter T in fun<T:View> findViewById(id: Int): T! Please specify it explicitly.


解决:

holder.btnInstall = convertView.findViewById(R.id.btn_install) as Button

改为

holder.btnInstall = convertView.findViewById<Button>(R.id.btn_install)


原创粉丝点击