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