2017-09-26 5 views
0

ankoを使用してカスタム要素で警告ダイアログを作成したいと思います。AndroidのAnkoアラートでカスタム表示エラー(Kotlin)

私が見つけたすべてのガイドとチュートリアルでは、このメソッドを使用しています。

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. 

はアンコに変更何かを持っているし、文書化されていませんか?

答えて

0

あなたは、Android Studioがあなたを示唆していることを2番目の項目を選択する必要があります -

'AlertBuilder <ためのCustomView *> org.jetbrains.ankoに'

enter image description here

関連する問題