【发布时间】:2020-04-20 07:47:34
【问题描述】:
private class FakeCardDrawable constructor(
context: Context) : CardDrawable(context) {
var text: String? = null
var backgroundColor = 0
var textColor = 0
override fun setColors(
backgroundColor: Int, textColor: Int, animate: Boolean
) {
this.backgroundColor = backgroundColor
this.textColor = textColor
}
fun setText(text: String) {
this.text = text
}
}
它抱怨说“平台声明冲突:以下声明具有相同的 JVM 签名(setText..)
【问题讨论】:
-
setText()方法由 kotlin 编译器自动生成,您不需要手动实现它们的开销。