简体   繁体   中英

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.

尝试将android:layout_below="@+id/buttonFindReplacement"ListView

android:layout_below="@+id/buttonFindReplacement"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM