PercentRelativeLayout在Android M上的行为有所不同

时间:2015-11-24 15:12:38

标签: android android-layout android-support-library android-percent-library

我使用PercentRelativeLayout作为网格项目布局的父级。 它在Android M之前运行良好,但在Android M上它是重叠的。

可能是什么原因?

这是项目布局:

<?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> 

以及它在预M设备上的外观:

enter image description here

并在Android M上:

enter image description here

0 个答案:

没有答案