Skip to content

Instantly share code, notes, and snippets.

@WendyYanto
Last active December 13, 2020 11:37
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 WendyYanto/f1f66d300e4161c7c1074fece9be64dd to your computer and use it in GitHub Desktop.
Save WendyYanto/f1f66d300e4161c7c1074fece9be64dd to your computer and use it in GitHub Desktop.
init {
val typeArray = context.theme.obtainStyledAttributes(attrs, R.styleable.LazyLoadComponent, 0, 0)
val parentResId = typeArray.getResourceId(R.styleable.LazyLoadComponent_parent_layout_id, -1)
val layoutRes = typeArray.getResourceId(R.styleable.LazyLoadComponent_layout_res, -1)
with(viewStub) {
layoutResource = layoutRes
addView(this)
}
typeArray.recycle()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment