我设置了如下的 XML布局,有一个TExt view和很多的check boxes和一个button。我在一个 Linear Layout 上附加上所有的check boxes,还设置了一个滚动视图。但是添加scrollview后button就已经看不见了,如何修改呢?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView />
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical" >
<LinearLayout>
<CheckBox />
<CheckBox />
<CheckBox/>
<CheckBox/>
<CheckBox/>
<CheckBox/>
<CheckBox/>
<CheckBox/>
<CheckBox />
<CheckBox/>
<CheckBox />
</LinearLayout>
</ScrollView>
<Button
</Button>
</LinearLayout>
把你的scrollview改一下,高度0dip,权重为1 试下,另外一个而布局文件中有两个“http://schemas.android.com/apk/res/android"” 会有错误吧
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
**android:layout_height="0dip"
android:layout_weight= "1"**
android:fillViewport="true"
android:orientation="vertical" >
用相对布局
让button一直处于底部,应该不会不见(本人用过)