I have a layout file and I'm passing it to a bitmap that I then send to a bluetooth printer in bytes.
According to the mobile resolution, it changes font sizes of textviews - the higher the resolution, the larger the font.
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 width of the print and is correct in the printer. Could someone help me with this?