我想动态添加一些小部件,如下所示:
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);
...但我得到,“方法 AddView(LinearLayout) 未定义类型 ScrollView”
那么我应该怎么做才能将LinearLayout添加到现有的ScrollView中呢?