gpt4 book ai didi

android - 如何在 Android 中显示来自字符串的一维条形码?

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:28:47 25 4
gpt4 key购买 nike

我正在使用 ZXing via intent 来扫描一维条形码。 ZXing 将扫描的一维条码类型(UPC-A、Code 39 等)和条码中编码的字符串发回给我。我想获取一维条形码的类型和字符串以及生成和图像,并将其显示在 Activity 的 ImageView 中。

我也愿意使用类似于“Free 3 of 9”的字体在 TextView 中显示条形码,但我不知道该怎么做。

我注意到 ZXing 中有一个名为 EncodeActivity 的 Activity 可以执行我需要的操作,但仅限于二维码。

如有任何帮助,我们将不胜感激。

谢谢。

最佳答案

使用 ZXing IntentIntegratorIntentResult 类!

    String data = "123456789";

Intent intent = new Intent("com.google.zxing.client.android.ENCODE");

intent.addCategory(Intent.CATEGORY_DEFAULT);

intent.putExtra("ENCODE_FORMAT", "CODE_128");

intent.putExtra("ENCODE_DATA", data);

startActivity(intent);

它只有在你的 Android 上安装了 Barcode reader 时才有效

如果你需要帮助,尽管问我!

关于android - 如何在 Android 中显示来自字符串的一维条形码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4865597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com