关于ScrollView不能显示 老报错 是因为ScrollView不能直接嵌套很多布局或是控件,最好让他套一个总布局。
//---------------------------------------例如:
//这第一种 这种布局ScrollView的嵌套,ScrollView嵌套了TextView,如果是这样的话,ScrollView根本无法正常显示出来!
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="aaaa"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="bbbb"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
//第二种 ScrollView嵌套RelativeLayout,RelativeLayout里再嵌套TextView,以下这种方式才可以让ScrollView正常显示。
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300dp">
<TextView
android:text="aaaa"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:text="bbbb"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</ScrollView>