3
I have a layout file and I’m passing it to a bitmap which I then send to a printer bluetooth in bytes.
According to the resolution of the cell phone, it changes the sizes of the sources of textviews - the higher the resolution, the higher the source.
How do I generate the same layout regardless of the device and its resolution?
My code:
layout.setDrawingCacheEnabled(true);
layout.measure(View.MeasureSpec.makeMeasureSpec(580, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(layout.getMeasuredHeight(), View.MeasureSpec.UNSPECIFIED));
layout.layout(0, 0, layout.getMeasuredWidth(), layout.getMeasuredHeight());
layout.buildDrawingCache(false);
Bitmap sImagem = Bitmap.createBitmap(layout.getDrawingCache(false));
layout.setDrawingCacheEnabled(false);
The 580 is the print width and is correct on the printer. Could someone help me with this?
still doesn’t work
– H. Cardoso
Then you have to explain the problem better.
– ramaral
this link has the application working: https://drive.google.com/open?id=0B0LBOPuhnAPiOWZYM3N1NC10VEk and if it is tested on phones with different resolutions you will be able to view the different bitmap
– H. Cardoso