Android Webview: how to scroll the whole layout of activities

I have an activity that displays the contents of an email message. There is a header with recipients and a date and a web view to display the contents of the mail.

When mail is very long, there is no problem; there are scroll bars in the webview.

But my problem is that the recipient list is very long, the title occupies 50% of the screen height, and web browsing takes only 50% of the screen height, and I can only scroll through these 50%. I would like to scroll the entire activity layout (I would like the webview to get its full height and this scrollbar appears in all the activity).

Here is an image illustrating my problem:

scroll problem

Here is my 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="&lt;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="&lt;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="&lt;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="&lt;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="&lt;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="&lt;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>
+5
source share
1

ScrollView, ScrollView .

, , , , -.

, , .

,

+1

All Articles