I have a LinearLayout that I am extending and I want to add a ViewFlipper and Views in it dynamically. Can anyone tell me why this is showing a blank screen?
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
ViewFlipper vf = new ViewFlipper(context);
vf.layout(l, t, r, b);
this.addView(vf);
TextView tv = new TextView(context);
tv.setText("FOO");
tv.setBackgroundColor(Color.WHITE);
vf.addView(tv, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
}
Have you overriden the onMeasure() method? I think you need to do this otherwise the View is not correctly sized. Someone please correct me if I am wrong