PercentRelativeLayout behaves differently on Android M

213 Views Asked by At

I'm using PercentRelativeLayout as parent for Grid item layout. It works fine pre Android M ,but on Android M it is overlapped.

What could be the reason?

Here is the item layout :

<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
    android:id="@+id/rootView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="15dp"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <TextView
        android:id="@+id/headline"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_above="@+id/divider_lay"
        android:layout_marginBottom="5dp"
        android:gravity="center|bottom"
        android:textSize="@dimen/large_text_size"
        app:layout_heightPercent="50%"
        />

    <include
        android:id="@+id/divider_lay"
        layout="@layout/ci_item_divider_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />


    <TextView
        android:id="@+id/body"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_below="@+id/divider_lay"
        android:layout_marginTop="5dp"
        android:gravity="center|top"
        android:textSize="@dimen/medium_text_size"
        app:layout_heightPercent="50%"
         />
</android.support.percent.PercentRelativeLayout> 

and here how it looks on pre M devices:

enter image description here

and on Android M:

enter image description here

0

There are 0 best solutions below