tags:

views:

24

answers:

0

I'm completely stumped on the use of ViewGroup and adding views programmatically. I've got an overrided ViewGroup class that I want to add a view to. I do it like this in the constructor:

public TestView(Context context) {

super(context);

textView = new TextView(context); textView.setText("This is a test."); textView.setId(1); textView.setTextColor(Color.rgb(0, 0, 0)); textView.setVisibility(VISIBLE); addView(textView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }

I can see everything I draw in the ViewGroup's OnDraw override, but I never see the textView getting drawn. This should be easy, so what am I missing?

Thanks!