布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="添加TextView控件"
android:onClick="add"
android:id="@+id/btn_add"
android:layout_gravity="center_horizontal"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="60dp"
android:background="@android:color/holo_blue_light">
<LinearLayout
android:id="@+i