开发者

problem to make scroll able,set scroll for whole layout android

had make layout for showing the content in listview and a button below on list view for displaying more information on list view ,so first i am showing only 4 rows in list view and when i next time click on button 4 rows again added in list so now my button goes down in screen so how to make whole layout scroll able so that i can go to button via scrolling my layout is..

listplacehold.xml is

    <?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>

items are dynamically loadein list view when button click

i think that scroll will be set on above xml means on "listplacehold.xml" but how?,when i am doing it is set to for half开发者_如何转开发 screen,means it is not displaying in whole view... Thanks for help in advance.


don't use the ScrollView with the combination of the ListView. Instead make your layout like this.

<?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>


put scrollview over your root layout and remember only one layout node is allowed under scrollview.....

refer this doc:

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜