Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Inlcude doesn't set LayoutParams from the XML #149

Closed
cypressious opened this issue Feb 29, 2016 · 0 comments
Closed

Inlcude doesn't set LayoutParams from the XML #149

cypressious opened this issue Feb 29, 2016 · 0 comments

Comments

@cypressious
Copy link
Contributor

Because in the implementation of include

inline fun <T: View> ViewManager.include(layoutId: Int, init: T.() -> Unit): T {
    @Suppress("UNCHECKED_CAST")
    return ankoView({ ctx -> ctx.layoutInflater.inflate(layoutId, null) as T }) { init() }
}

null is passed as the second parameter, layout parameters from the XML are not applied. I propose to add an overload where the receiver is of type ViewGroup and use the three argument version of inflate to add the parent container like so: inflate(layoutId, this, false)

@yanex yanex added this to the Anko 0.9 milestone Mar 25, 2016
@yanex yanex closed this as completed in 6ef1bcf May 18, 2016
@yanex yanex added fixed and removed open labels May 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants