• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Creating a resizable background with two different colors of different heights

I created this xml file that draws two rectangles of different heights and colors and the different colors are used as a way to divide the layout. It looks fine on my device but the problem is that on some devices the black rectangle is much larger than the white rectangle because these are absolute values and not percentages. I want to create a background where 75 percent of the background has the color white and 25 of the background has the color black and they have to be solid colors. What I can do so that the layout automatically does this?

Code:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:bottom="20dp">
        <shape android:shape="rectangle" >
            <size android:height="100dp" />
            <solid android:color="#ffffff" />
        </shape>
    </item>

    <item android:top="350dp">
        <shape android:shape="rectangle" >
            <size android:height="10dp" />
            <solid android:color="#000000" />
        </shape>
    </item>
</layer-list>
 
Back
Top Bottom