I want to dynamically add some widgets like so:
LinearLayout llay = new LinearLayout(this);
llay.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
llp.weight = 1.0f;
CheckBox cb = new CheckBox(getApplicationContext());
cb.setText("1");
cb.setLayoutParams(llp);
llay.addView(cb);
ScrollView svh = (ScrollView) findViewById(R.id.scrollViewHost);
svh.AddView(llay);
...but I'm getting, "The method AddView(LinearLayout) is undefined for the type ScrollView"
So what should I do to add the LinearLayout to the existing ScrollView?
Because Java is case sensitive? AddView()
!= addView()
. Also (though not the root of the problem), note that a ScrollView
can only have one child.