//在这里插入代码片
public class QrCodeGenerator {
public static Bitmap generateBitmap(String content, int width, int height, boolean needDeleteWhiteBorder) {
try {
Hashtable<EncodeHintType, Object> hints = new Hashtable<>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
hints.put(EncodeHintType.MARGIN, 1);
BitMatrix matrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);
if (needDeleteWhiteBorder) {
matrix = deleteWhite
Android生成二维码、去除白边的工具类
最新推荐文章于 2024-07-20 20:59:02 发布
本文介绍了一个在Android平台上生成二维码并去除白边的实用工具类,使用了core-3.0.0.jar库,适用于Android应用开发中的二维码生成需求。
摘要由CSDN通过智能技术生成