Android Studio Kotlin:ArrayAdapter 不允许我覆盖 getView 函数
Android Studio Kotlin: ArrayAdapter won't let me override the getView function
当我按照他们在教程中所做的那样尝试构建我自己的 getView 函数时,我得到了这个错误:
"意外覆盖:以下声明具有相同的 JVM 签名 (getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;):"=12=]
class MyArrayAdapter(
context: Context?,
resourceId: Int,
items: List<Cards?>?
) : ArrayAdapter<Cards?>(context!!, resourceId, items!!) {
fun getView(position: Int, convertView: View, parent: ViewGroup): View {
}
看来你确实忘记了 override 修饰符
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {}
当我按照他们在教程中所做的那样尝试构建我自己的 getView 函数时,我得到了这个错误:
"意外覆盖:以下声明具有相同的 JVM 签名 (getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;):"=12=]
class MyArrayAdapter(
context: Context?,
resourceId: Int,
items: List<Cards?>?
) : ArrayAdapter<Cards?>(context!!, resourceId, items!!) {
fun getView(position: Int, convertView: View, parent: ViewGroup): View {
}
看来你确实忘记了 override 修饰符
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {}