I'm trying to create a simple Drawable that I want to set as the background for a view (using setBackgroundDrawable). I simply want to divide the background of the drawable into 2 equal rectangles (50% - 50%), the first want filled with black, the second with white:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/back_color_1">
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
<item android:id="@+id/back_color_2">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
How can I specify that each shape should have a width of 50% in the drawable XML definition file? Something like android:width="50%".
(I'm working on Android 3.0, but I think it is a general Android question.)
P.S: You can do this in CSS or XAML.