In my application, there are several components with different heights that have the same gradient background (I used several shapes and a gradient element in the list of layers).
but in the item tag, I have to specify the height of the form at 50dip, and I want to reuse it in several percentage-based user interfaces.
I found that the weight attribute is not supported in the figure. so is there any other alternative to make it work with different sizes or in any percentage supported way?
I want to get an XML style solution.
the list of layers 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>
source share