2011-09-02 53 views
0

已經佈局顯示列表視圖中的內容和列表視圖下方的按鈕列表視圖中顯示更多信息,所以首先我只顯示列表視圖中的4行當我下次點擊按鈕4行再次添加列表中,所以現在我的按鈕在屏幕下降,所以如何使整個佈局滾動能夠讓我可以去滾動我的佈局按鈕是..問題使滾動能夠設置整個佈局的滾動android

listplacehold。 XML是

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

    <RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
    android:background="#1A77BD" 

    > 

    <ListView 
android:id="@+id/android:list" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_weight="1" 
android:drawSelectorOnTop="false" /> 
<View 
    android:id="@+id/horizontolline" 
    android:layout_width="fill_parent" 
    android:layout_height="1dip" 
    android:layout_below="@id/android:list" 
    android:background="#000000" 
    /> 

<Button 
android:text="Load More..." 
android:textColor="@color/white" 
android:id="@+id/keywordsearchbutton" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_below="@id/horizontolline" 
android:drawableLeft="@drawable/load_more_off" 
android:gravity="left|center_vertical" 
android:background="#1A77BD" 
/> 


    </RelativeLayout> 



    and for list item layout is: listitem.xml is 




    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <ImageView android:id="@+id/img" 
    android:layout_height="wrap_content"   
    android:layout_width="wrap_content" 
    /> 
    <!-- Location where barrio items will be displayed -->       
    <TextView 
android:id="@+id/reportid" 
android:layout_marginLeft="70dip" 
android:text="reporet id" 
android:textColor="@color/white" 
android:layout_height="wrap_content"   
android:layout_width="wrap_content" 
/> 

<TextView android:id="@+id/status" 
android:textColor="@color/white" 
android:text="status" 
android:layout_marginTop="40dip" 
android:layout_marginLeft="200dip" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" /> 
<TextView android:id="@+id/title" 
android:text="title" 
android:layout_marginLeft="150dip" 
android:textColor="@color/white"    
android:layout_width="wrap_content" 
android:layout_height="wrap_content" /> 
<TextView 
android:id="@+id/date" 
android:text="dateeeeeee" 
android:layout_marginLeft="70dip" 
android:layout_marginTop="40dip" 
android:textColor="@color/white" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" />      

</RelativeLayout> 

項目動態loadein列表視圖時,點擊鏈接

我認爲滾動將設置上面的xml意味着「listplacehold.xml」,但如何?,當我這樣做是設置爲一半的屏幕,意味着它不顯示在整個視圖...感謝您的幫助提前。

回答

-1

放滾動視圖在你的根佈局,只記得一個佈局節點下滾動視圖允許.....

參考這個文檔:

http://developer.android.com/reference/android/widget/ScrollView.html

+0

這將不會在OP的情況下工作,因爲他使用的ListView不能在ScrollView中使用。看到你所引用的文檔,第二段的概述:http://developer.android.com/reference/android/widget/ScrollView.html – ForceMagic

0

不使用滾動型ListView的組合。而是像這樣做你的佈局。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#1A77BD" > 
    <Button 
    android:id="@+id/lodmore" 
    android:text="Load More..." 
    android:textColor="@color/white" 
    android:id="@+id/keywordsearchbutton" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true"" 
    android:drawableLeft="@drawable/load_more_off" 
    android:gravity="left|center_vertical" 
    android:background="#1A77BD"/> 
    <View 
    android:id="@+id/horizontolline" 
    android:layout_width="fill_parent" 
    android:layout_height="1dip" 
    android:layout_above="@id/loadmore" 
    android:background="#000000"/> 

    <ListView 
    android:id="@+id/android:list" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:layout_alignParentTop="true" 
    android:layout_above="@id/horizontolline/> 

</RelativeLayout> 
+0

按鈕隱藏時,我加載了更多的項目通過按鈕點擊我的列表視圖...所以如何sc直到按鈕? – shyam

+0

實際上按鈕顯示在屏幕的底部,我想顯示按鈕從哪裏列表行結束意味着下方列表視圖,當我再次點擊按鈕時,它加載更多的內容,所以按鈕將下降,所以如何使它scrollabe達到butoon ..感謝,我正在等待你的回覆 – shyam

+0

其實ListView有默認的滾動條。當您在ListView上使用ScrollView時,系統可能無法識別您要滾動的scrollView。這樣就有可能導致應用程序不正常。 –