I'm designing my own tab control. I've created 2 custom views. The first is called MyTab and derives from LinearLayout. The second is called MyTabBar and derives from LinearLayout.
The constructor of both look something like this:
public MyTab(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.layout_my_tab, this);
}
MyTabBar has a member variable which is an ArrayList of MyTabs. I have a public function called addTab(String strTabName) to add a new MyTab to the MyTabBar. My question is, when I do the following:
MyTab tab = new MyTab(...);
inside of MyTabBar, how do I obtain the Context and AttributeSet required to be passed to MyTab?
Or should I be inflating it somehow?