Android examples for android.graphics:Bitmap Operation
compound Bitmap Center Horizontal
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; public class Main { public static Bitmap compoundBitmapCenterHorizontal(Bitmap bg, Bitmap fg, int top) { Bitmap result = Bitmap.createBitmap(bg.getWidth(), bg.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); canvas.drawBitmap(bg, 0, 0, null); int widthBg = bg.getWidth(); int widthFg = fg.getWidth(); canvas.drawBitmap(fg, (widthBg - widthFg) / 2, top, null); return result; }//from w ww . jav a2s.c om }