在添加下方的控件时上方对应的产生了缝隙
布局<?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">    <include layout="@layout/title"></include>    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal">            <include
                layout="@layout/title_2"
                android:layout_width="0dp"
                android:layout_height="840dp"
                android:layout_weight="1"></include>
            <LinearLayout
                android:layout_width="0dp"
                android:layout_weight="14"
                android:layout_height="840dp">
                <include
                    android:id="@+id/MON"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>                <include
                    android:id="@+id/TUE"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>                <include
                    android:id="@+id/WED"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>                <include
                    android:id="@+id/THR"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>                <include
                    android:id="@+id/FRI"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>                <include
                    android:id="@+id/SAT"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>                <include
                    android:id="@+id/SUN"
                    layout="@layout/week"
                    android:layout_width="0dp"
                    android:layout_height="840dp"
                    android:layout_weight="2"></include>
            </LinearLayout>        </LinearLayout>
    </ScrollView>
</LinearLayout>添加控件的代码     switch (course.getWeek()){
            case 1:
                layout=(RelativeLayout)findViewById(R.id.MON);
                break;
            case 2:
                layout=(RelativeLayout)findViewById(R.id.TUE);
                break;
            case 3:
                layout=(RelativeLayout)findViewById(R.id.WED);
                break;
            case 4:
                layout=(RelativeLayout)findViewById(R.id.THR);
                break;
            case 5:
                layout=(RelativeLayout)findViewById(R.id.FRI);
                break;
            case 6:
                layout=(RelativeLayout)findViewById(R.id.SAT);
                break;
            case 7:
                layout=(RelativeLayout)findViewById(R.id.SUN);
                break;
        }
        int height=course.getEnd()-course.getStart()+1;
        final CourseButton button=new CourseButton(this,id);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,getPixelsFromDp(70*height));
        button.setText(course.getName()+"\n"+course.getClassroom());
        button.setBackgroundColor(course.getColor());
        button.setAllCaps(false);
        button.setY(getPixelsFromDp((course.getStart()-1)*70));
        Log.e(TAG, Float.toString(layout.getY()) );
        layout.addView(button,params);