我有一个显示电子邮件内容的活动。有一个带有收件人和日期的标题,以及一个用于显示邮件内容的 web 视图。
邮件很长的时候,没问题,webview里面有滚动条。
但是我的问题是当收件人列表很长时,header占屏幕高度的50%,而webview只占屏幕高度的50%,我只能在这50%里面滚动。我想滚动整个活动布局(我希望 webview 得到它的全高,并且滚动条出现在整个活动上)。
这是一张说明我的问题的图片:
这是我的 layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="vertical"
android:scrollbars="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@layout/header_gradient" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#DEDEDE"
android:orientation="vertical"
android:padding="2dp" >
<TextView
android:id="@+id/label_mail_object"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="<mail_object>"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/label_mail_from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="<from>"
android:textColor="#0000FF" />
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="0"
android:stretchColumns="1" >
<!-- Send time -->
<TableRow
android:id="@+id/tablerow_sent_date"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_sent_date"
android:textStyle="bold" />
<TextView
android:id="@+id/label_mail_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="<sent_date>" />
</TableRow>
<!-- To -->
<TableRow
android:id="@+id/tablerow_to"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_to"
android:textStyle="bold" />
<TextView
android:id="@+id/label_mail_to"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxWidth="@dimen/padding_large"
android:text="<to>" />
</TableRow>
<!-- Cc -->
<TableRow
android:id="@+id/tablerow_cc"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_cc"
android:textStyle="bold" />
<TextView
android:id="@+id/label_mail_cc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxWidth="@dimen/padding_large"
android:text="<cc>" />
</TableRow>
<!-- To -->
<TableRow
android:id="@+id/tablerow_cci"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_cci"
android:textStyle="bold" />
<TextView
android:id="@+id/label_mail_cci"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxWidth="@dimen/padding_large"
android:text="<cci>" />
</TableRow>
</TableLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#808080" />
<WebView
android:id="@+id/webview_mail_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>