Android PercentRelativeLayout in a ListView shows nothing

185 Views Asked by At

I am trying to build a ListView with PercentRelativeLayout, but it draws nothing.

I'm using Genymotion's custom phone with andoird 4.4.4 (API level 19).

When I switch to RelativeLayout of LinearLayout the items appear. In PercentRelativeLayout, it shows nothing.

What am I doing wrong?

Your help would be much appreciated.

Attached is an ugly scheme of the List View item. The image item isn't included yet.

<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

   <TextView
       android:id="@+id/projects_lv_item_title"
       android:layout_width="match_parent"
       app:layout_heightPercent="50%"
       />

   <TextView
       android:id="@+id/projects_lv_item_desc"
       android:layout_width="match_parent"
       app:layout_heightPercent="50%"
       />



</android.support.percent.PercentRelativeLayout>

enter image description here

1

There are 1 best solutions below

2
On

Give an explicit height to PercentRelativeLayout, and add android:layout_height="wrap_content" to both TextViews.