Android layout question

Hi

I have the following layout:

<LinearLayout>
<TextView>
<TextView>
<ScrollView>
<ListView>
</ScrollView>
<Button>
</LinearLayout>

When I put the ListView into the ScrollView I can only see one item of the ListView.
I am not sure what layout parameters I should be using
zattzAsked:
Who is Participating?
 
SanthanaConnect With a Mentor Technical LeadCommented:
Hi zattz,

I thing this will help you

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dip"
        android:text="Text1" />

    <TextView
        android:id="@+id/editText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editText1"
        android:layout_margin="10dip"
        android:text="Text2"
        android:textAlignment="gravity" />

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/button1"
        android:layout_below="@+id/editText2" />

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="Button" />

</RelativeLayout>
0
 
Molnar IstvánHelpDesk / ProgrammerCommented:
first add the button on the bottom of the relativelayout and then add the listview:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:text="Button" />

    <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button1"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" >

    </ListView>

</RelativeLayout>

http://www.experts-exchange.com/Programming/Languages/Java/Android/Q_27841691.html#a38339211
0
 
zattzAuthor Commented:
When I do it that way it puts the Button to the left of the ListView. I want the button at the top of the ListView, taking up the entire width of the linearlayout.
0
 
zattzAuthor Commented:
Thank you, that was very helpful
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.