2013-03-30 2 views
5

Ich habe eine Aktivität, die den Inhalt einer E-Mail anzeigt. Es gibt eine Kopfzeile mit Empfängern und Datum und eine Webansicht zum Anzeigen von E-Mail-Inhalt.Android Webview: Wie scrollt man das gesamte Aktivitätslayout

Wenn die Mail sehr lang ist, kein Problem, es gibt Bildlaufleisten in der Webansicht.

Aber mein Problem ist, wenn die Empfängerliste sehr lang ist, nimmt die Kopfzeile 50% der Bildschirmhöhe, und die Webansicht nimmt nur 50% der Bildschirmhöhe, und ich kann nur innerhalb dieser 50% scrollen. Ich würde gerne das gesamte Aktivitätslayout durchblättern (ich möchte, dass die Webansicht ihre volle Höhe erhält und diese Bildlaufleiste auf der gesamten Aktivität erscheint). Hier

ist ein Bild, mein Problem darstellt:

scroll problem

Hier mein layout.xml ist:

<?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> 

Antwort

1

warum nicht nur die Liste Sachen des Empfängers wickeln innerhalb eines Scrollview, und legen Sie Die Höhe dieses ScrollViews ist auf eine Größe Ihrer Wahl eingestellt.

Auf diese Weise können sie weitergehen und durch die Empfänger scrollen, wenn sie wünschen und immer noch den Großteil des Bildschirms für die Web-Ansicht reserviert haben.

Wenn Sie die gesamte Ansicht mit einem einzigen Bildlauf möchten, dann machen Sie das gleiche, aber einfach alles umhüllen.

Schlag mich auf, wenn du nicht verstehst

+0

Großartig !!! Ich habe das ganze Layout mit einem ScrollView umrahmt, und es scrollt wie ich wollte !!! – MarneusCalgarXP

+1

Ich habe vergessen zu sagen: Vielen Dank;) – MarneusCalgarXP

Verwandte Themen