XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/iv_tree"
android:scaleType="fitXY"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:src="@drawable/my_tree" />
</RelativeLayout>
MyView.java :
public MyView extends View{
private Bitmap head_1, head_2;
public MyView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.context = context;
init();
}
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
init();
}
public MyView(Context context) {
super(context);
this.context = context;
init();
}
private void init(){
head_1= BitmapFactory.decodeResource(context.getResources(),
R.drawable.head_1);
head_2= BitmapFactory.decodeResource(context.getResources(),
R.drawable.head_2);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawBitmap(head_1, coordinateX_head_1, coordinateY_head_1, null);
canvas.drawBitmap(head_2, coordinateX_head_2, coordinateY_head_2, null);
}
}
You choose the coordinate you want, you can even use function like canvas.getWidth() or canvas.getHeight(). Pose yourself as a painter. Good luck.