2011-09-02 56 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。这样就有可能导致应用程序不正常。 –