1

When I use a view in listview item, it doesn't show the view for the item when I use android:layout_height="match_parent". If i set some value for the layout_height like 50dp, it works usually. The problem is that I cant set a specific value for height, I need it all the height.

Anybody knows how to solve that problem?

Edit:

Listview item xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white" >

    <View
        android:id="@+id/lv_main_view_account"
        android:layout_width="@dimen/activity_horizontal_margin"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true" />

    <View
        android:id="@+id/lv_main_view_category"
        android:layout_width="@dimen/activity_horizontal_margin"
        android:layout_height="fill_parent"
        android:layout_alignParentRight="true" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toLeftOf="@id/lv_main_view_category"
        android:layout_toRightOf="@id/lv_main_view_account"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginTop="@dimen/activity_horizontal_margin"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/lv_main_date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/dark_gray" />

            <TextView
                android:id="@+id/lv_main_value"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginRight="@dimen/activity_horizontal_margin"
                android:gravity="right"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/lv_main_local"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_toLeftOf="@id/lv_main_value"
                android:layout_toRightOf="@id/lv_main_date"
                android:textColor="@color/black"
                android:textStyle="bold" />
        </RelativeLayout>

        <TextView
            android:id="@+id/lv_main_description"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/activity_horizontal_margin"
            android:layout_marginLeft="@dimen/activity_horizontal_margin"
            android:layout_marginRight="@dimen/activity_horizontal_margin"
            android:textColor="@color/black" />
    </LinearLayout>

</RelativeLayout>
Douglas Fornaro
  • 2,017
  • 2
  • 22
  • 30

1 Answers1

0

It is not going to work at all. If you really want to do that you can set the height of the item inside your ListView's adapter.

Getting screen size

Setting the height

Community
  • 1
  • 1
eluleci
  • 3,489
  • 1
  • 26
  • 24