Skip to content

Instantly share code, notes, and snippets.

@Lamartio
Last active September 10, 2018 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lamartio/939151313c07b2fe6f3c560aa05d9b1e to your computer and use it in GitHub Desktop.
Save Lamartio/939151313c07b2fe6f3c560aa05d9b1e to your computer and use it in GitHub Desktop.
LinearLayout(this) layout {
+TextView(context).apply {
text = "Hello world"
}
}
class Layout<V : ViewGroup>(val layout: V) : ViewManager by layout, ViewParent by layout {
val context = layout.context
operator fun <V : View> V.unaryPlus(): V =
also(layout::addView)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment