[英]Scrollview and nested LinearLayouts
这是我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/yellow" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include
android:id="@+id/header"
layout="@layout/header" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="10dp"
android:background="@drawable/green"
android:orientation="vertical" >
<TextView/>
<TextView/>
<TextView/>
<TextView/>
</LinearLayout>
</LinearLayout>
</ScrollView>
外观如下:
蓝色是标题, 黄色是ScrollView, 绿色是LinearLayout,我要填充用红色箭头标记的空间。
为了使用ScrollView,我还使用了一个包含标题和绿色LinearLayout的LinearLayout。
问题 :如何使Green LinearLayout填充到底部的整个空间?
在ScrollView上,尝试将填充视口设置为true。
您可以通过xml或代码来实现。
http://developer.android.com/reference/android/widget/ScrollView.html#setFillViewport(boolean )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.