2010-11-30 16 views
6

मैं ASCII रूप में लेआउट है कि एक xml फ़ाइल है:बनाना एंड्रॉयड सूचीदृश्य लेआउट स्क्रॉल

--------------- 
| ImageView 
-------------- 
| TextView 
-------------- 
| List... 
-------------- 

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:myapp="http://schemas.android.com/apk/res/com.some.app" 
android:orientation="vertical" android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<ImageView 
android:id="@+id/MovieCover" 
android:layout_width="100dip" 
android:layout_height="100dip" 
/> 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textSize="16sp" 
    android:padding="10dp" 
    android:id="@+id/TextHeader" 
    android:background="#000000"> 
</TextView> 
<ListView android:id="@+id/ListView02" android:layout_height="wrap_content" 
android:layout_width="fill_parent"> 
</ListView> 
</LinearLayout> 

मैं लेआउट प्रदर्शित जब मेरे imageView और TextView से अधिक 3/4 तक ले जाता है में समस्या आ रही स्क्रीन। मैं ListView के साथ ImageView और TextView स्क्रॉल करने योग्य कैसे प्रदर्शित करूं? इस समय, केवल सूची दृश्य को स्क्रॉल करने के लिए और मैं चाहता हूं कि पूरा लेआउट स्क्रॉल करने योग्य हो जैसे कि वे स्वयं एक पृष्ठ हैं।

मैं यह कैसे कर सकता हूं?

+1

आदर्श रूप से स्क्रॉलव्यू के अंदर पूरे लेआउट को काम करना चाहिए, लेकिन एंड्रॉइड दिशानिर्देशों का कहना है कि सूची दृश्य को स्क्रॉलव्यू के अंदर नहीं रखना है, इसलिए इसके लिए समाधान जानने के लिए उत्सुक है! –

उत्तर

3

आप

<ScrollView> 
    <LinearLayout> 
    // your layout here 
    </LinearLayout> 
</ScrollView> 

कारण है कि हम जरूरत LinearLayout के अंदर है कि scrollview केवल एक प्रत्यक्ष बच्चे हो सकता है की रेखा के साथ अपने लेआउट कंटेनर के रूप में उपयोग कर सकते हैं <ScrollView>

कुछ

+2

यह काम नहीं कर रहा है ... ListView सभी – PCS

0

कैसे एक लेआउट में ImageView और TextView डालने और इस लेआउट को स्क्रॉलव्यू के अंदर डालने के बारे में।

1

मक्खन layoutweight="1" के साथ दो LinearLayout उपयोग करें और अन्य

<LinearLayout android:layout_weight="1" 
     android:layout_height="fill_parent" android:layout_width="fill_parent"> 
     <ScrollView android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
      <LinearLayout android:orientation="vertical" 
       android:layout_width="fill_parent"    
           android:layout_height="fill_parent"> 

          <!-- scroll view content --> 
      </LinearLayout> 
     </ScrollView> 
    </LinearLayout> 
    <LinearLayout android:layout_weight="1" 
     android:layout_height="fill_parent" android:layout_width="fill_parent"> 
     <ListView android:id="@+id/ListView02" android:layout_height="wrap_content" 
      android:layout_width="fill_parent"> 
     </ListView> 
    </LinearLayout> 
1

ListView में एक और सूचीदृश्य में scrollview डाल addtoHeader और addtoFooter कार्य है करने के लिए। एक अलग लेआउट बनाएं और इसे सूची दृश्य के शीर्षलेख में जोड़ें। आपके मामले में छविदृश्य और टेक्स्टव्यू का सापेक्ष लेआउट बनाएं और इसे सूचीदृश्य के शीर्षलेख में जोड़ें। पूरा पृष्ठ स्क्रॉलिंग शुरू हो जाएगा।

+0

पर स्क्रॉल नहीं करेगा यह काम किया। यह स्वीकार्य उत्तर होना चाहिए –

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