[英]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.