6

In my application there are more than one components with different height which do have same gradient background(I have used multiple shapes and gradient item in layer-list).

but in item tag i have to specify the height of shape in 50dip and i want to reuse it in more than one UI-Components with percentage measures.

I found that there is no weight attribute supported in the shape. so is there any other alternative to make it working in different sized views or any percentage supported way?

I want to get the solution in XML style.

the layer list looks like

<?xml version="1.0" encoding="utf-8"?>
<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android"
    >
    <item
        android:drawable="@drawable/green_horizontal_gradient"
        android:id="@+id/upper_gradient"
        />
    <item
        android:drawable="@drawable/half_overlay"
        android:id="@+id/lower_overlay"
        android:top="50dp"
        />
</layer-list>
Jitendra
  • 1,107
  • 2
  • 12
  • 22
  • Possible duplicate of [Android Drawable: Specifying shape width in percent in the XML file?](http://stackoverflow.com/questions/6061387/android-drawable-specifying-shape-width-in-percent-in-the-xml-file) – tir38 May 24 '16 at 22:47

0 Answers0