fix: 缩小二维码白色边框(静默区 4格→1格)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -70,10 +70,13 @@ class BindFragment : BaseFragment<FragmentBindBinding>() {
|
|||||||
))
|
))
|
||||||
Timber.d("绑定: QR 数据=$qrData")
|
Timber.d("绑定: QR 数据=$qrData")
|
||||||
|
|
||||||
// ZXing 生成二维码 Bitmap
|
// ZXing 生成二维码 Bitmap(缩小静默区,让二维码更大)
|
||||||
val size = 500
|
val size = 500
|
||||||
|
val hints = hashMapOf<com.google.zxing.EncodeHintType, Any>(
|
||||||
|
com.google.zxing.EncodeHintType.MARGIN to 1 // 默认4格,改为1格
|
||||||
|
)
|
||||||
val bitMatrix: BitMatrix = MultiFormatWriter().encode(
|
val bitMatrix: BitMatrix = MultiFormatWriter().encode(
|
||||||
qrData, BarcodeFormat.QR_CODE, size, size
|
qrData, BarcodeFormat.QR_CODE, size, size, hints
|
||||||
)
|
)
|
||||||
val bitmap = bitMatrixToBitmap(bitMatrix)
|
val bitmap = bitMatrixToBitmap(bitMatrix)
|
||||||
binding.ivQrCode.setImageBitmap(bitmap)
|
binding.ivQrCode.setImageBitmap(bitmap)
|
||||||
|
|||||||
Reference in New Issue
Block a user