Guilherme Gregores
Guilherme Gregores

Reputation: 1048

ScrollView decreases my ListView

I would like to make a layout with a search area and a ListView into a ScrollView for both.

But the ListView doesn't fill the layout ><

Code:

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

    <ScrollView
        android:id="@+id/scrollView1"
        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:orientation="vertical" >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <EditText
                    android:id="@+id/edt_procura_cliente"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:ems="10" />

                <Button
                    android:id="@+id/button1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="2.3"
                    android:lines="1"
                    android:text="Procurar" />
            </LinearLayout>


            <ListView
                android:id="@+id/list_clientes_visitas"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >

            </ListView>
        </LinearLayout>
    </ScrollView>

</RelativeLayout>    

Upvotes: 0

Views: 219

Answers (2)

Guilherme Gregores
Guilherme Gregores

Reputation: 1048

Found a solution for it, here:How can I put a ListView into a ScrollView without it collapsing?

Works fine for me

Upvotes: 0

Blackbelt
Blackbelt

Reputation: 157457

You can not put a ListView inside a ScrollView. The ListView has its own scrolling.

Upvotes: 1

Related Questions