xml配置文件:<LinearLayout android:id="@+id/linerLayout01"xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
><TextView 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tips01"
/> 
<Spinner 
android:id="@+id/equiTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/><TextView 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tips02"
/> 
</LinearLayout>
 核心代码 public class MainActivity extends Activity {private LinearLayout linerLayout01 ;
private CheckBox equiCheckBox ;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);linerLayout01 = (LinearLayout)this.findViewById(R.id.linerLayout01); //
setContentView(linerLayout01);//无论是把这个放在前面还是后面,都显示空指针equiCheckBox = new CheckBox(this);
equiCheckBox.setText("checkbox");LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
linerLayout01.addView(equiCheckBox, lp); //这里显示空指针// setContentView(linerLayout01);//无论是把这个放在前面还是后面,都显示空指针
}

我只想在xml文件里面用程序动态地添加控件而已,应该怎么弄?
因为我要根据客户需要多少个控件,我就在本来已经配好的一部分
的界面之中,再加入控件。。
到底要怎么做,我头又大了