我們會動到的文件如下──
AndroidManifest.xml
MainActivity.java (或是其它的Activity類的Class檔案)
AndroidManifest.xml
MainActivity.java (或是其它的Activity類的Class檔案)
this.setMinimumWidth(100);
this.setMinimumHeight(100);
private Bitmap mergeBitmap(Bitmap firstBitmap, Bitmap secondBitmap) {
int newWidth = firstBitmap.getWidth() + secondBitmap.getWidth();
Bitmap bitmap = Bitmap.createBitmap(newWidth, firstBitmap.getHeight(),
firstBitmap.getConfig());
Canvas canvas = new Canvas(bitmap);
canvas.drawBitmap(firstBitmap, 0, 0, null);
canvas.drawBitmap(secondBitmap, firstBitmap.getWidth(), 0, null);
canvas.save(Canvas.ALL_SAVE_FLAG);//保存
canvas.restore();
return bitmap;
}
private DoubleImage(Bitmap bm1, Bitmap bm2){
ImageView imgView = new ImageView(this);
Drawable[] layers = new Drawable[2];
layers[0] = new BitmapDrawable(getResources(),bm1);
layers[1] = new BitmapDrawable(getResources(),bm2);
LayerDrawable layerDrawable = new LayerDrawable(layers);
imgView.setImageDrawable(layerDrawable);
}
ViewGroup _p = (ViewGroup) getWindow().getDecorView().findViewById(android.R.id.content);
ViewGroup _p = (ViewGroup) this.findViewById(android.R.id.content);
private void addView(View bview){
title_txt = new TextView(this);
title_txt.setText("測試");
ViewGroup vg = ((ViewGroup) bview.getParent());
vg.addView(title_txt);
}