1

我想从 wifi 打印机打印布局我正在使用打击代码打印视图但它不起作用

 screenshot = Bitmap.createBitmap(v.getMeasuredWidth(), 
   v.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
       // screenshot=Bitmap.createScaledBitmap(screenshot, width,height, 
       true);
        Canvas canvas = new Canvas(screenshot);
        v.draw(canvas);
        doPhotoPrint(screenshot);

//doprint方法

  private void doPhotoPrint( Bitmap bitmap) {
  PrintHelper photoPrinter = new PrintHelper(PrintActivity.this);
   photoPrinter.setScaleMode(PrintHelper.SCALE_MODE_FIT);
   photoPrinter.printBitmap("Print", bitmap);
   }
4

0 回答 0