static final int PICKED_TWO = 1;
boolean onePicked = false;
boolean twoPicked = false;
Button choosePicture1, choosePicture2;
我们将有一个ImageView用于显示最终的合成图像。同时还需要有两个位图对象,为每幅选定的图像使用一个该对象。
mageView compositeImageView;
Bitmap bmp1, bmp2;
与前面的示例一样,将需要一个在其上绘制的Canvas对象和一个进行绘制的Paint对象。
Canvas canvas;
Paint paint;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
compositeImageView = (ImageView) this.findViewById(R.id.CompositeImageView);choosePicture1 = (Button) this.findViewById(R.id.ChoosePictureButton1);
choosePicture2 = (Button) this.findViewById(R.id.ChoosePictureButton2);
choosePicture1.setOnClickListener(this);
choosePicture2.setOnClickListener(this);
}