Gazeciarz
Gazeciarz

Reputation: 525

Relative layout with listview android

I have a problem with correct placing listview in relative layout with EditText and Button.

<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"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".ProductsMainActivity" >

    <TextView
        android:id="@+id/emptyTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:ems="10" >
    </EditText>

    <Button
        android:id="@+id/buttonFindReplacement"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Szukaj zamiennika" />

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:divider="#33B5E5"
        android:dividerHeight="1dp"
        android:drawSelectorOnTop="false" >
    </ListView>

</RelativeLayout>

This will make something like this: https://www.dropbox.com/s/7ynp1uxya20kc0t/device-2013-11-27-232830.png

I need the listview drawing from the bottom of the EditBox & Button to the end of the screen (if there will be as much records if not it should ends before bottom). When there will be more records on listview that it can match on the screen propably I could make listView scrollable so It won't cause problems.

Upvotes: 1

Views: 5598

Answers (2)

Elsanty
Elsanty

Reputation: 148

android:layout_below="@+id/buttonFindReplacement"

Upvotes: 1

panini
panini

Reputation: 2026

try adding android:layout_below="@+id/buttonFindReplacement" to your ListView

Upvotes: 3

Related Questions