Set height for a relative layout containing a listView - android

I'm currently developing an Android app and I've got an issue concerning layout. In my XML layout file, I create a relative layout (fill_parent for width and wrap_content for height) which contains a list View (or possibly an expendable List View - fill_parent for height and width). In the corresponding activity onCreate method, I just set the adapter corresponding to my list and attach it to my list. The problem is that when I run my app the relative layout only has a size of 93dip and so it hides my list which has a size from 67 to 210dip when I would like the relative layout height to stick to the list current size (The size will never change through action in the activity just possibly when creating or resuming the activity). Would anyone have an idea of a solution to fix that ?
Some code as asked :
<LinearLayout android:id="#+id/content"
android:layout_width="fill_parent"
android:background="#drawable/row"
android:layout_below="#+id/header"
android:layout_height="wrap_content">
<ListView android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/listrow"/>
</LinearLayout>
And in the java file (where snapRecords is my object lists):
m_panel = (RelativeLayout)findViewById(R.id.lastFareRecordPanel);
ListView lv = (ListView)m_panel.findViewById(R.id.list);
final QuickSnapBookmarksAdapter adapter = new QuickSnapBookmarksAdapter(snapRecords, getApplicationContext(), this, lv);
lv.setAdapter(adapter);
Many thanks in advance for your help !
Benja

I had a similiar situation.When I changed parent layout into LinearLayout, it is working.Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/LinearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/prev"
android:layout_width="106dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#null"
android:onClick="prev"
android:paddingTop="8dip"
android:src="#drawable/previous" >
</ImageButton>
<ImageButton
android:id="#+id/next"
android:layout_width="106dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#null"
android:onClick="next"
android:paddingTop="8dip"
android:src="#drawable/next" >
</ImageButton>
<ImageButton
android:id="#+id/Logout"
android:layout_width="106dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#null"
android:onClick="logout"
android:paddingTop="8dip"
android:src="#drawable/logout1"
android:text="#string/Logout" >
</ImageButton>
</LinearLayout>
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="330dip" >
</ListView>
<TextView
android:id="#android:id/empty"
android:layout_width="fill_parent"
android:layout_height="338dip"
android:text="#string/EmptyList"
android:textSize="35dip" />
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/prev1"
android:layout_width="106dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#null"
android:onClick="prev"
android:src="#drawable/previous" >
</ImageButton>
<ImageButton
android:id="#+id/next1"
android:layout_width="106dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#null"
android:onClick="next"
android:src="#drawable/next" >
</ImageButton>
<ImageButton
android:id="#+id/Logout"
android:layout_width="106dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#null"
android:onClick="logout"
android:src="#drawable/logout1"
android:text="#string/Logout" >
</ImageButton>
</LinearLayout>
</LinearLayout>

Related

EditText and textView will not fit within layout bounds

I'm building a gridView which replicates the basic functionality of a Launcher (it allows you to create new folders - and arrange them within the gridView).
My problem is I have a textView and an imageView (which should appear below the bottom most tile [it is either white or grey depending on how many times the add image button is clicked] in the screenshot below) however they are being pushed outside the bounds of the layout for some reason - and I'm having trouble identifying which one is causing this to occur.
I've tried many different combinations of height and width paramaters as well as trying Linear vs Relative layout for my innermost child layout - but I still can't seem to keep the textView and an imageView from being pushed outside the layout completely and I'm having a bit of trouble nailing down what exactly is causing it.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0" >
<GridView
android:id="#+id/image_grid_view"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.8"
android:background="#color/grid_background"
android:gravity="center"
android:horizontalSpacing="2dip"
android:numColumns="#integer/num_columns"
android:stretchMode="columnWidth"
android:verticalSpacing="2dip" />
<RelativeLayout
android:id="#+id/bottom_part"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_weight="0.2"
android:background="#android:color/black"
android:orientation="horizontal"
android:weightSum="1.0" >
<Button
android:id="#+id/button_add_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:onClick="onClickAddImage"
android:text="Add image" />
<com.example.project.DeleteZone
android:id="#+id/delete_zone_view"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:src="#drawable/delete_zone" />
<FrameLayout
android:id="#+id/image_source_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="#+id/sqwhite"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:layout_marginRight="5dp" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#id/sqwhite"
android:layout_marginRight="5dp" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#id/editText1"
android:layout_marginRight="5dp"
android:text=""
android:textColor="#android:color/white" />
</RelativeLayout>
</FrameLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
Your FrameLayout is redundant as it only contains a LinearLayout, but more importantly it's set to 80dp height. This means that anything beyond 80dp will not be visible. Try setting it to wrap_content.

ListView inside a ScrollView issue in Android

Here is my XML layout. I have a list view inside my scrollview. I am setting the height manually if I change the listview height to wrap_content it is not working. And also if the data grows beyond the limit it is hiding. I am seeing many answers to solve this. What is the best option to solve it for my case?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:focusableInTouchMode="true" >
<LinearLayout
android:id="#+id/store_scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="#c6c6c6"
android:padding="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout_alignParentLeft="true"
android:text="Stores"
android:textSize="20dp" />
<TextView
android:id="#+id/merchant_count_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="0 Results" />
</RelativeLayout>
<Gallery
android:id="#+id/gallery1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"
android:gravity="left"
android:listSelector="#color/gridviewlistselector"
android:paddingLeft="10dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:spacing="10dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#c6c6c6"
android:padding="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout_alignParentLeft="true"
android:text="Products"
android:textSize="20dp" />
<Spinner
android:id="#+id/filter_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_toRightOf="#+id/textView1" />
<TextView
android:id="#+id/product_count_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="0 Results" />
</RelativeLayout>
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="4800dp"
android:layout_weight="1"
android:drawSelectorOnTop="true"
android:listSelector="#color/gridviewlistselector"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Short answer: You can't (shouldn't) have a ListView wrapped in a ScrollView.
Long answer: As Romain Guy (UI-guru at Google themselves) once said:
Using a ListView to make it not scroll is extremely expensive and goes against the whole purpose of ListView. You should NOT do this. Just use a LinearLayout instead.
Quote via "How can I put a ListView into a ScrollView without it collapsing?".
Instead using List View in ScrollView you can make separate layout where you can define your desired components. then you can make that layout haeder of the ListView. You can use following code:
LayoutInflater inflater = LayoutInflater.from(this);
View LTop = inflater.inflate(R.layout.header_tolistview, null);
listview.addHeaderView(LTop);

adding elements to scrollview using java when there is more then 1 child

I am trying to add elements to my scrollview,
this scroll view has a vertical linear layout inside of it.
(i added another linear layout - horizontl, inside that will manage 2 textviews and an image according to the attributes i assigned them),
i am trying to add elements of this inner layout to my scroll view (id=insideLineLayout)
(each element added to scrollview will contain these 2 texts and an image)
because of the fact scrollview can only have 1 child i am unable to do this.
would appreciate some help, nothing seems to be working here.
Thanks.
my current xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/searchScreenOuterLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/catagoryselectedText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="70dp"
android:text="selected catagory"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="12dp"
android:orientation="horizontal" >
<EditText
android:id="#+id/searchText"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp" />
<ImageButton
android:id="#+id/searchButton"
android:layout_width="50dp"
android:layout_height="40dp"
android:background="#drawable/search_icon" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="10dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/radiusText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:paddingTop="5dp"
android:text="Search Radius"
android:textAppearance="?android:attr/textAppearanceMedium" />
<SeekBar
android:id="#+id/radiusBar"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" />
</LinearLayout>
<ScrollView
android:id="#+id/searchScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/searchScrollViewLinear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="10dp" >
<LinearLayout
android:id="#+id/insideLineLayout"
android:layout_width="fill_parent"
android:layout_height="30dp"
android:orientation="horizontal"
android:weightSum="100"
>
<TextView
android:id="#+id/linesPrice"
android:layout_weight="20"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="tmp1"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/linesInfo"
android:layout_weight="60"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="tmp2"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/imageInfo"
android:layout_width="40dp"
android:layout_height="match_parent"
android:background="#drawable/tv_icon" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Consider how long your list can get as ListView has been optimized in many ways which a regular scroll view is not. If you have too many elements you might start get out of memory exceptions.
In order to dynamically add views to a ScrollView you first need to get the container view inside the ScrollView (most likely a LinearLayout), then you simply do following for each view you add:
View view = inflater.inflate(R.layout.view_to_add, container, false); // this is used if you create from xml, if you make it in code you'd use the regular constructor.
// update the view content (view.findViewById(); etc.)
container.addView(view);

Automatically adjustable layout (having ListView) at runtime

I have an activity with dialog theme. Its layout has 3 parts
HEADER
BODY (HAS ListView)
OK BUTTON
This has to be the structure of my layout always. If I use following layout xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/iv_av_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="2dip"
android:paddingLeft="6dip"
android:src="#drawable/tablet_ic_logo" />
<RelativeLayout
android:id="#+id/rl_av_found"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/iv_av_logo"
android:layout_marginBottom="5dip"
android:paddingLeft="16dip" >
<TextView
android:id="#+id/tv_av_found"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/orange"
android:textSize="22dp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_av_recommendation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tv_av_found"
android:layout_marginBottom="8dip"
android:textColor="#color/white"
android:textSize="13dp"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:id="#+id/ll_av_body"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/rl_av_found"
android:background="#drawable/tablet_dialog_glow" >
<ListView
android:id="#+id/lv_av_threats_found"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="#drawable/tablet_dialog_separator" >
</ListView>
</LinearLayout>
<RelativeLayout
android:id="#+id/rl_button_bar"
android:layout_width="wrap_content"
android:layout_height="70dip"
android:layout_below="#id/ll_av_body" >
<Button
android:id="#+id/btn_av_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:onClick="onClick"
android:text="#string/btn_ok" />
<ImageView
android:id="#+id/iv_separator"
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_alignParentTop="true"
android:background="#drawable/tablet_dialog_footer" />
</RelativeLayout>
</RelativeLayout>
It gives me what I want. But if the list grows and I have say 100 items, OK button goes out of the picture.
And if I use this layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/iv_av_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="2dip"
android:paddingLeft="6dip"
android:src="#drawable/tablet_ic_logo" />
<RelativeLayout
android:id="#+id/rl_av_found"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/iv_av_logo"
android:layout_marginBottom="5dip"
android:paddingLeft="16dip" >
<TextView
android:id="#+id/tv_av_found"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/orange"
android:textSize="22dp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_av_recommendation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tv_av_found"
android:layout_marginBottom="8dip"
android:textColor="#color/white"
android:textSize="13dp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_button_bar"
android:layout_width="wrap_content"
android:layout_height="70dip"
android:layout_alignParentBottom="true" >
<Button
android:id="#+id/btn_av_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:onClick="onClick"
android:text="#string/btn_ok" />
<ImageView
android:id="#+id/iv_separator"
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_alignParentTop="true"
android:background="#drawable/tablet_dialog_footer" />
</RelativeLayout>
<LinearLayout
android:id="#+id/ll_av_threats"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#id/rl_button_bar"
android:layout_below="#id/rl_av_found"
android:background="#drawable/tablet_dialog_glow" >
<ListView
android:id="#+id/lv_av_found"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="#drawable/tablet_dialog_separator" >
</ListView>
</LinearLayout>
</RelativeLayout>
The OK button is always displayed at the bottom of the screen and the layout's height takes full screen even if I have just one item in the ListView.
How should I structure my xml so as to have its height wrapped according to the content and OK button always visible independent of the number of items in the ListView?
By Default you should have the params as,
Header - Align Top
Body(ListView) - Below header,
Button - below body(ListView)
Now at runtime,
You should get the height of the list view and if it goes beyond the screen, and if it does, then Set the layout params of button to alignParentBottom and layout params of list view to be below header and above button.
Use may use this in vice versa.
To get the height of the list view. Use this
public int getTotalListViewHeight(ListView lv, BaseAdapter ba) {
int listviewElementsheight = 0;
for (int i = 0; i < ba.getCount(); i++) {
View view = ba.getView(i, null, lv);
view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
listviewElementsheight += view.getMeasuredHeight();
// for Width use view.getMeasuredWidth()
}
return listviewElementsheight;
}
Here the adapter is listviews adapter.
also will checking this, add the buttons height to the total height.

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

Categories

Resources