2013-03-30 9 views
5

मेरे पास एक ऐसी गतिविधि है जो ईमेल की सामग्री प्रदर्शित करती है। प्राप्तकर्ताओं और दिनांक के साथ एक शीर्षलेख है, और मेल सामग्री प्रदर्शित करने के लिए एक वेबदृश्य है।एंड्रॉइड वेबव्यू: संपूर्ण गतिविधि लेआउट को कैसे स्क्रॉल करें

जब मेल बहुत लंबा है, कोई समस्या नहीं है, वेबव्यू के अंदर स्क्रॉलबार हैं।

लेकिन मेरी समस्या तब होती है जब प्राप्तकर्ता सूची बहुत लंबी होती है, हेडर स्क्रीन की ऊंचाई का 50% लेता है, और वेबव्यू स्क्रीन की ऊंचाई का केवल 50% लेता है, और मैं केवल इन 50% के अंदर स्क्रॉल कर सकता हूं। मैं पूरे गतिविधि लेआउट पर स्क्रॉल करना चाहता हूं (मुझे लगता है कि वेबव्यू की पूरी ऊंचाई हो जाएगी, और वह स्क्रॉलबार पूरी गतिविधि पर दिखाई देगी)।

यहाँ एक चित्र मेरी समस्या को दर्शाता हुआ है:

scroll problem

यहाँ मेरी 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> 

उत्तर

1

क्यों नहीं सिर्फ एक scrollview भीतर प्राप्तकर्ता का सूची सामान लपेट, और फिर सेट यह स्क्रॉलव्यू की लेआउट ऊंचाई आपके चयन के आकार के लिए है।

इस तरह वे आगे बढ़ सकते हैं और प्राप्तकर्ता के माध्यम से स्क्रॉल कर सकते हैं यदि वे चाहते हैं और अभी भी वेब व्यू को समर्पित स्क्रीन का बहुमत है।

यदि आप एक ही स्क्रॉल के साथ पूरा दृश्य चाहते हैं, तो वही करें लेकिन बस सब कुछ लपेटें।

अगर आपको

+0

ग्रेट नहीं समझा जाता है तो मुझे मारो !!! मैंने स्क्रॉलव्यू के साथ पूरे लेआउट को घेर लिया, और यह स्क्रॉल करता था जैसा मैं चाहता था !!! – MarneusCalgarXP

+1

मैं कहना भूल गया: बहुत बहुत धन्यवाद;) – MarneusCalgarXP

संबंधित मुद्दे