I'm trying to use PercenRelativeLayout into ListView, but it doesnot works, height and width percents are ignored and nothing were showing into the listview. it works only for marshmallows.
here is list item xml
<?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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:background="#d20404"
android:id="@+id/test_image_id"
android:layout_width="match_parent"
android:layout_height="300dp" />
<TextView
android:background="#000"
android:text="sfgfashdsfg"
android:layout_below="@+id/test_image_id"
app:layout_heightPercent="50%"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.percent.PercentRelativeLayout>
I have a sample project on github
I have opened this issue to google. The answer were
https://code.google.com/p/android/issues/detail?id=202479
I encountered the same problem with android K and android L.
Convert your percent relative layout to relative layout and set the height of the views programmatically according to your device height.
This is not a very elegant solution but it worked for me.
XML Code:
Java Code: