create QRCode
fun createQRCode(content: String, size: Int, logo: Bitmap? = null, @FloatRange(from = 0.0, to = 1.0 ) ratio: Float = 0.2f, hints: Map<EncodeHintType, *>? = buildQRCodeHints(), @ColorInt codeColor: Int = Color.BLACK): Bitmap?
生成二维码。
该方法对应 Java 版本中的多组重载:可选中间 Logo、Logo 比例、编码参数与二维码颜色。 在 Kotlin 中通过默认参数进行统一。
Return
生成成功返回 Bitmap,失败返回 null。
Parameters
content
二维码内容。
size
二维码边长(像素)。
logo
二维码中间的 Logo;为 null 时不添加。
ratio
Logo 占二维码宽度比例,建议不超过 0.3。
hints
编码参数,默认使用高容错、utf-8、边距 1。
code Color
二维码前景色。