create Bar Code
fun createBarCode(content: String, desiredWidth: Int, desiredHeight: Int, hints: Map<EncodeHintType, *>? = null, isShowText: Boolean = false, textSize: Int = 40, @ColorInt codeColor: Int = Color.BLACK): Bitmap?
生成条形码(默认格式 BarcodeFormat.CODE_128)。
对应 Java 多重重载的 Kotlin 统一入口,可控制编码参数、是否显示文字、文字大小和颜色。
Return
生成成功返回 Bitmap,失败返回 null。
Parameters
content
条形码内容。
desired Width
目标宽度。
desired Height
目标高度。
hints
编码参数。
is Show Text
是否在条形码下方显示文本。
text Size
文本字号(当 isShowText=true 时生效)。
code Color
条形码颜色。
fun createBarCode(content: String, format: BarcodeFormat, desiredWidth: Int, desiredHeight: Int, hints: Map<EncodeHintType, *>? = null, isShowText: Boolean = false, textSize: Int = 40, @ColorInt codeColor: Int = Color.BLACK): Bitmap?
生成条形码。
Return
生成成功返回 Bitmap,失败返回 null。
Parameters
content
条形码内容。
format
条形码格式。
desired Width
目标宽度。
desired Height
目标高度。
hints
编码参数。
is Show Text
是否在条形码下方显示文本。
text Size
文本字号(当 isShowText=true 时生效)。
code Color
条形码颜色。