Access the properties of comopnent inside item renderer
I have an Item Renderer having HBox. Now I want to add child in that HBox from my application file using addChild method. Could anybody please suggest me the w开发者_StackOverfloway around for the same. I am not able to access the properties of HBox inside the item renderer.
Thanks in advance!
Don't try to do that - even if you get a reference to the instance of item renderer and make modifications to it (addChild or whatever), you'll loose it when the item renderers are recycled. And item renderers are frequently recycled - for example when you scroll the list. If the list has 100 items and only 10 are visible at a given time, only 11 or so instances of item renderers will be created. Those instances will be showed in a cycle - when you scroll, the data in them are updated using the set data
method.
Override the set data
method in the item renderer and do the stuff from there.
精彩评论