Arpit
Arpit

Reputation: 2217

At what point are all Viewgroup children created and ready to set some initial properties?

I am working on a custom ViewGroup that extends LinearLayout but only accepts children of a particular subclass. At the first possible moment I have the opportunity, I want to set some properties on the children (things like their index etc). In Flex there is a method called createChildren() where all children are created and then an event called creationComplete is fired (the children are created but not measured/laid out yet). Whats the equivalent in Android?

Upvotes: 1

Views: 223

Answers (1)

b_yng
b_yng

Reputation: 14136

Is there a reason for adding properties to the view before it is drawn? If not than you can use myViewGroup.setTag(myObjectTag) to attach an object to the view (perhaps Integer since you want to use it to index) and myViewGroup.getTag() to return the view's object "tag".

Upvotes: 1

Related Questions