在Android中叠加两个图像以设置一个imageview
我正在尝试在应用程序中叠加两个图像,但是它们似乎在我的canvas.setBitmap()行崩溃了。我究竟做错了什么? private void test() { Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.t); Bitmap mBitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.tt); Bitmap bmOverlay = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap.getConfig()); Canvas canvas = new Canvas(); canvas.setBitmap(bmOverlay); canvas.drawBitmap(mBitmap, new Matrix(), null); canvas.drawBitmap(mBitmap2, new Matrix(), null); testimage.setImageBitmap(bmOverlay); }