1. viewstub在xml里面定义的时候
<ViewStub
android:id="@+id/header_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/bar_height"
android:layout="@layout/header_bar" />
必须用android:layout
2. android:layout_width, android:layout_height以viewstub中的为准,如果在layout的最外层加入了宽高,也是不起作用的