Android how to reduce available draggable graphics overlay layer

I am creating a simple example. Take a look enter image description here

This is a simple layout.

LinearLayout with children

  • Relative - bg = test_drawable_1
  • Relative - bg = test_drawable_2
  • Relative - bg = test_drawable_3
  • Relative - bg = test_drawable_4
  • Relative - bg = test_drawable_5

Each test_drawable is a flexible XML file with a root element and layer list forms. Each number is the number of figures

As the number of layers in the form increases, overdraw will increase

Markup

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:background="@drawable/test_drawable_1"
        android:layout_marginBottom="8dp"></RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:background="@drawable/test_drawable_2"
        android:layout_marginBottom="8dp" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:background="@drawable/test_drawable_3"
        android:layout_marginBottom="8dp" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:background="@drawable/test_drawable_4"
        android:layout_marginBottom="8dp" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:background="@drawable/test_drawable_5"
        android:layout_marginBottom="8dp" />
</LinearLayout>

test_drawable_1

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape>
            <corners android:radius="@dimen/gs_GridSize2x" />
            <padding android:top="1dp" android:right="1dp" android:left="1dp" android:bottom="1dp"/>
            <solid android:color="#95C4CF"/>
        </shape>
    </item>
</layer-list>

Is there any way to reduce GPU overload by using a drawn xml list of layers?

+4
source share

All Articles