Kotlin

来源:互联网 发布:自动关注软件源码 编辑:程序博客网 时间:2024/06/18 17:39
API level 26
报错信息:
Type inference failed: Not enough information to infer parameter T in fun findViewById(p0: Int): T! Please specify it explicitly.
解决方案:
var iv_photo: ImageView = findViewById(R.id.iv_photo) as ImageView改为:
var iv_photo: ImageView = findViewById<ImageView>(R.id.iv_photo)

var iv_photo: ImageView = itemView?.findViewById(R.id.iv_photo) as ImageView改为:
var iv_photo: ImageView = itemView?.findViewById<ImageView>(R.id.iv_photo) as ImageView
原创粉丝点击