5
我有一个显示电子邮件内容的活动。 有一个包含收件人和日期的标题以及一个显示邮件内容的web视图。Android Webview:如何滚动整个活动布局
当邮件很长时,没问题,webview里面有滚动条。
但我的问题是,当收件人列表很长,头采用屏幕高度的50%,和web视图只用了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>
大!我用ScrollView将整个布局包围起来,并按照我的意愿滚动! – MarneusCalgarXP
我忘了说:非常感谢你;) – MarneusCalgarXP