【问题标题】:Android Anko alert with custom view error (Kotlin)带有自定义视图错误的 Android Anko 警报 (Kotlin)
【发布时间】:2017-09-26 23:08:09
【问题描述】:

我想使用 anko 创建一个带有自定义元素的警报对话框。

我发现的每个指南和教程都使用这种方法:

alert {
    customView {
        textView("Hello")
    }
}.show()

但我在customView 中收到错误消息:

Error:(73, 13) Type inference failed: Not enough information to infer parameter T in inline fun <reified T : View> Activity.customView(theme: Int = ..., init: T.() -> Unit): T
Please specify it explicitly.

Anko 中是否发生了一些变化并且没有记录在案?

【问题讨论】:

    标签: android android-studio kotlin anko


    【解决方案1】:

    您应该选择 Android Studio 建议您的第二项 -

    'org.jetbrains.anko 中 AlertBuilder 的自定义视图'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多