2011-05-31 14 views
9

मैं ListActivity के लिए ListView के नीचे एक प्रोग्रेसबार दृश्य डालने का प्रयास कर रहा हूं। मैं सूची सूची में हमेशा अंतिम पंक्ति से नीचे रहना चाहता हूं।एंड्रॉइड लिस्ट एक्टिविटी - ListView के नीचे एक दृश्य कैसे जोड़ें?

प्रोग्रेसबार, जो लीनियरलाउट में रखा गया है, तब तक प्रकट होता है जब तक सूची (जो रनटाइम पर एडाप्टर द्वारा भरी जाती है) स्क्रीन से अधिक नहीं है। जैसे ही सूची स्क्रीन से बड़ी हो, प्रगतिबार अब दिखाई नहीं दे रहा है।

लेआउट एक्सएमएल इस तरह दिखता है:

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/db1_root" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical"> 

<!-- Title bar --> 
<LinearLayout 
    style="@style/TitleBar" > 
    <TextView 
     style="@style/TitleBarText" 
     android:text="Some title text" /> 
    <ImageButton 
     style="@style/TitleBarAction" 
     android:contentDescription="@string/description_search" 
     android:src="@drawable/title_search" /> 
</LinearLayout> 

<!-- Content --> 
<LinearLayout 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" > 

    <ListView 
     android:divider="@drawable/category_item_divider" 
     android:dividerHeight="@dimen/list_divider_height" 
     android:layout_height="wrap_content" 
     android:id="@+id/android:list" 
     android:layout_width="fill_parent" 
     android:layout_weight="1" />   
    <TextView 
     android:id="@+id/android:empty" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:text="@string/category_no_items" />     
</LinearLayout>  

<!-- Progress bar --> 
<LinearLayout 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" > 

    <ProgressBar 
     android:id="@+id/productlist_progressbar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 
</LinearLayout> 

</LinearLayout> 

एक LinearLayout के साथ संभव नहीं है? किसी भी मदद की सराहना की।

+0

फ़ूटरव्यू के साथ फ़ूटर स्क्रॉल करें, यदि आप दृश्यमान के नीचे स्क्रीन पर नीचे दिए गए दृश्य को देखना चाहते हैं, तो सूचीदृश्य – urSus

उत्तर

12

आप का उपयोग कर एक पाद लेख जोड़ना चाहिए:

list.addFooterView(footerView); 

या इसे मैन्युअल रूप से कर रही है, लेकिन फिर रिश्तेदार लेआउट का उपयोग करें, वहाँ रेखीय लेआउट तुलना में कहीं अधिक शक्तिशाली हैं। और उसके बाद अपने पाद लेख को सूची के नीचे रखें, या बेहतर, अपनी सूची और अपने फुटव्यू के ऊपर अपना खाली दृश्य रखें।

+0

पर वज़न सेट करें, फ़ूटर व्यू बिल्कुल वही है जो मैं ढूंढ रहा था। मेरे पास अब एकमात्र छोटा मुद्दा यह है कि मैंने अपनी सूची दृश्य में एंड्रॉइड: डिवाइडर सेट किया है, और जब मैंने फुटेज व्यू को दृश्यता = GONE सेट किया है (यह केवल अधिक डेटा लोड करते समय उपयोग किया जाता है), मेरे पास नीचे दो डिवाइडर हैं। मान लीजिए कि इसके लिए कोई "फिक्स" नहीं है :-) – Bachi

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