This repository has been archived by the owner on Jul 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
lparams() for Layouts/_CollapsingToolbarLayout returns FrameLayout.LayoutParams #275
Milestone
Comments
Yes, it's a bug. Just put the following code anywhere:
And then
|
hi, i've just encountered the very same problem. nesting one layout (linear) into another (relative) leads to an ambiguous there is no way i know to tell the compiler which my current workaround is to do it the hard way and dismiss the DSL approach: relativeLayout {
linearLayout {
layoutParams = RelativeLayout.LayoutParams(wrapContent, wrapContent).apply {
alignParentRight() // which is only available for RelativeLayout params
}
}
} the long way as suggested above, by reimplementing private val defaultInit: Any.() -> Unit = {}
fun <T: View> T.lparams_rl(
width: Int = android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
height: Int = android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
init: RelativeLayout.LayoutParams.() -> Unit = defaultInit
): T {
val layoutParams = RelativeLayout.LayoutParams(width, height)
layoutParams.init()
this@lparams_rl.layoutParams = layoutParams
return this
} |
can anyone fix this bug
we need someone to do this job |
Fixed with 1b5653c |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
etc.
But CollapsibleToolbarLayout has its own LayoutParams with additional features. Is it a bug or does it have some particular reason?
Thanks
The text was updated successfully, but these errors were encountered: