Uisng XML is it possible to create a drawable where half of it would be color1 and another half would be color2? When I set that drawable as a background of a view it should look like in the image below.
Doing it by xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="100dp">
<shape android:shape="rectangle">
<size android:height="100dp" android:width="100dp"/>
<solid android:color="@android:color/black"/>
</shape>
</item>
<item android:left="100dp">
<shape android:shape="rectangle">
<size android:height="100dp" android:width="100dp"/>
<solid android:color="@android:color/holo_green_light"/>
</shape>
</item>
</layer-list>
Put it in res/drawable
folder and assign as android:background
to image
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With