Kotlin / anko

Pleasant Android application development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lparams() can't be called in this context by implicit receiver. Use the explicit one if necessary

mvysny opened this issue · comments

I have the following code which compiled okay with Kotlin 1.2.71 and Anko 0.10.5:

        scrollView {
            verticalLayout {
                horizontalLayout {
                    imageView {
                        setImageResource(R.mipmap.aedict_icon)
                    }.lparams(width = matchParent, height = dip(96)) { weight = 2f }
                    textView("Aedict v${AedictApp.getVersion()}") {
                        gravity = Gravity.CENTER
                        textSize = 34f
                    }.lparams(width = matchParent) { weight = 1f; gravity = Gravity.CENTER }
                }.lparams(width = matchParent) { margin = dip(8) }
                textView {
                    autoLinkMask = Linkify.WEB_URLS or Linkify.EMAIL_ADDRESSES
                    textResource = R.string.about
                    gravity = Gravity.CENTER
                }.lparams(width = matchParent)
            }.lparams(width = matchParent)
        }

It doesn't compile anymore: 'inline fun <T : View> _LinearLayout.lparams(width: Int = ..., height: Int = ..., init: FrameLayout.LayoutParams.() -> Unit): _LinearLayout' can't be called in this context by implicit receiver. Use the explicit one if necessary
Any ideas what have been changed? It seems that the verticalLayout function no longer returns _LinearLayout but it returns just LinearLayout?

Ah right, I was using Anko 0.10.6, 0.10.8 fixed the issue.