当前位置: 代码迷 >> Android >> Android把view的画面转换为bit地图
  详细解决方案

Android把view的画面转换为bit地图

热度:32   发布时间:2016-05-01 15:18:05.0
Android把view的画面转换为bitmap

ImageView iv = (ImageView) findViewById(R.id.ImageView01);ImageView iv2 = (ImageView) findViewById(R.id.ImageView02);ImageView iv3 = (ImageView) findViewById(R.id.ImageView03); //draw的方式对整屏截取,但信息栏为黑色View cv = getWindow().getDecorView();  Bitmap b = Bitmap.createBitmap(200, 200, Bitmap.Config.RGB_565);  cv.draw(new Canvas(b));iv.setImageBitmap(b); //对隐藏的未画过的对象,截出的是黑色Bitmap image = Bitmap.createBitmap(200, 200, Bitmap.Config.RGB_565);bt3.draw(new Canvas(image));iv2.setImageBitmap(image); //get drawable cache , bitmap to drawablebt4.setDrawingCacheEnabled(true);Bitmap bitmap = bt4.getDrawingCache();Drawable drawable = (Drawable) new BitmapDrawable(bitmap);iv3.setBackgroundDrawable(drawable);
?
  相关解决方案