三张图片压缩显示成一张图片

static private Drawable GetNewDrawableEditDel(Drawable fontDrawable,
   Drawable bgDrawable, Drawable bgDelDrawable) {

  Drawable[] array = new Drawable[3];
  array[2] = bgDrawable;
  array[0] = bgDelDrawable;
  array[1] = fontDrawable;

  array[1].setAlpha(40);
  LayerDrawable ld = new LayerDrawable(array);
  // 令前景居中
  int l = (array[1].getIntrinsicWidth() - array[0].getIntrinsicWidth()) / 2;
  int t = (array[1].getIntrinsicHeight() - array[0].getIntrinsicHeight()) / 2;

  // int l = array[1].getIntrinsicWidth() * 20/100;
  // int t = l;

  ld.setLayerInset(0, l, t, l, t);
  ld.setAlpha(255);
  return ld;

你可能感兴趣的:(三张图片压缩显示成一张图片)