1

I'm running into some really strange behaviour when running this (test) layout on my OnePlus6T but it works fine when i run it in the emulator.

There is a gray bar appearing below the FrameLayout which increases/decreases in size depending on the elevation (smaller elevation means wider but less tall bar).

It only occurs when using a combination of an elevation and corner specific radius (using plain android:radius instead of bottomRightRadius makes it appear normal). Also, when I change the outlineProvider from background to something else, it works as well.

Can anyone confirm this behaviour on other phones and/or is it a known bug? I tried it on a friends Moto X4 and it works fine there.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#DCDCDC"
    tools:context=".MainActivity">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginStart="40dp"
        android:layout_marginTop="40dp"
        android:layout_marginEnd="40dp"
        android:layout_marginBottom="40dp"
        android:background="@drawable/background_rounded"
        android:outlineProvider="background"
        android:elevation="100dp">
   </FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@drawable/background_rounded.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">
    <solid android:color="@android:color/white" />
    <corners android:bottomRightRadius="64dp" />
</shape>

Screenshot from my 6T Incorrect layout

Screenshot from API28 Emulator Correct layout

Myth1c
  • 639
  • 1
  • 7
  • 23

0 Answers0