From what I have understood in Stackoverflow till now...all that the instance of LayoutInflater
does is accepts the XML layout file to be inflated (probably using some internal XML parser and iteration logic to instantiate view from the tree-like structure set it's attributes accordingly) and as well as the parent to which the tree should be attached along with an optional attachToRoot
parameter. This means that the inflater itself doesn't hold any unique information from wherever it gets instantiated. So why isn't the functionality of creating/inflating a view available in the form of a simple static method that just creates the view with the parameters passed to it? Is it that I am missing out on something?
Also, I am unable to understand the concept of attachToRoot
... The code in this answer passes attachToRoot as false and states that the layout wouldn't directly attach the view yet? Does it mean that if we would have passed true, we wouldn't have needed manually add that view? (Just as a side question again, would the behavior of the app be different if we would have changed the properties after adding it) https://stackoverflow.com/a/41500409/10104608