I'm creating my own custom LinearLayout, and extending it's class I need to add children to the layout using the addview method,
I need to have access on the tag, which is set after the constructor, so please I need to know the best practice for doing something like this
here's my code:
public class MyLayout extends LinearLayout {
public MyLayout(Context context) {
super(context);
MyTag tag = (MyTag) getTag();
// Parent layout
setOrientation(VERTICAL);
setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
setBackgroundColor(tag.getBgColor());
}
}