1

I have a layer-list that I am using as the background to RelativeLayout in my app. (this layout is being used as an overlay on top of other apps/browsers in android which is why you see chrome in the screenshot below). One of the shapes in the layer-list is a rotated rectangle. I want to use elevation to provide a shadow for this layer-list but it appears as though the shadow for the rotated element is the same as if it were not rotated.

drawable bubble.xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:left="0dp"
        android:top="20dp">
    <rotate
      android:fromDegrees="-45"
      android:pivotX="0%"
      android:pivotY="0%"
      android:toDegrees="0">
      <shape android:shape="rectangle" >
        <padding android:top="0dp" />
        <solid android:color="#FFFFFF" />
      </shape>
    </rotate>
  </item>
</layer-list>

Layout file:

<RelativeLayout
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_alignBottom="@+id/opbFab"
  android:layout_alignParentTop="true"
  android:layout_toEndOf="@+id/opbFab"
  android:layout_toRightOf="@+id/opbFab"
  android:height="20dp"
  android:background="@drawable/bubble"
  android:elevation="10dp"
  android:gravity="center_vertical"
  android:orientation="horizontal"
  android:textColor="@color/primary">
...
</RelativeLayout>

The first image shows the shape when it has not been rotated with the correctly applied elevation/shadow.

The second image shows that the shape (white rectangle) has been rotated but the shadow remains the same.

Correct shadow: Example of correctly applied elevation when the shape is not rotated.

Incorrect shadow: shadow has not changed but the white box has been rotated.

Gabe O'Leary
  • 2,010
  • 4
  • 24
  • 41
  • Are you sure that you used the right tags in the question?, I mean that's is a web page related to html&css, no xml here, if you have the android app, please provide the xml code? –  Mar 08 '18 at 18:25
  • @Ibrahim do you have any suggestions for appropriate/inappropriate tags? (I just added `android-drawable`) – Gabe O'Leary Mar 08 '18 at 18:30
  • It will be better if you provide the layout.xm and the drawable.xml, also that's not belong to android it's belong to websites what ever the web build with, you should provide screens from android-app not google-chrome!. I think you didn't define the issue as well. –  Mar 08 '18 at 18:33
  • The element in question is overlayed on top of web browsers, not a part of my application. I will go ahead and provide additional details in the question. – Gabe O'Leary Mar 08 '18 at 19:19

0 Answers0