2

The xml below in Nougat is ignoring the marginLeftPercent.

<?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:id="@+id/container"       
android:layout_width="match_parent" 
android:layout_height="match_parent">

<TextView
    android:id="@+id/inBoxButton"
    app:layout_widthPercent="20%"
    app:layout_marginLeftPercent="30%"
    app:layout_marginTopPercent="2%"
    android:layout_height="40dp"
    android:text="Inbox"
    android:textSize="18sp"
    android:tag="1"
    android:lines="1"
    android:gravity="center"
    android:textColor="@color/black_color"
    />

I have other places in my app where it's not ignored, but those other places do not have layout_widthPercent. This works fine in 6.0, but I think it's a bug in 7.0.

Onik
  • 19,396
  • 14
  • 68
  • 91
Bob Lissner
  • 255
  • 4
  • 17
  • I found the problem, mostly mine. My JAVA extends ViewGroup. It should have been extending PercentRelativeLayout. Interesting, still maybe a bug, that some of the PercentRelativeLayout terms (percentWidth) still DID work. And it all worked until 7.0. Should have extended PercentRelativeLayout. – Bob Lissner May 07 '17 at 15:58

0 Answers0