如何通过ViewFinder自定义zxing条码扫描器的捕获屏幕边框 [英] How to Customize the capture screen border of zxing barcode scanner from ViewFinder

查看:101
本文介绍了如何通过ViewFinder自定义zxing条码扫描器的捕获屏幕边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.journeyapps.barcodescanner.BarcodeView
            android:id="@+id/zxing_barcode_surface"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:zxing_framing_rect_height="220dp"
            app:zxing_framing_rect_width="250dp" />


        <com.journeyapps.barcodescanner.ViewfinderView
            android:id="@+id/zxing_viewfinder_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:zxing_possible_result_points="@color/zxing_custom_possible_result_points"
            app:zxing_result_view="@color/zxing_custom_result_view"
            app:zxing_viewfinder_laser="@color/zxing_custom_viewfinder_laser"
            app:zxing_viewfinder_mask="@color/zxing_custom_viewfinder_mask" />
    </RelativeLayout>

</merge>

我想自定义条形码的捕获区域,并且我正在使用zxing嵌入式条形码,因此我应该如何自行设置条形码区域的边界.我只知道对ViewFinder类进行了一些更改,但是ViewFinder类在jar库的库中,所以我该如何更改?

I want to customize the capturing area of barcode and i am using the zxing embeded barcode so how shall i make the border of barcode area by my self. I just know that some changes would be don to ViewFinder class but the ViewFinder class is in library in jar library so how could i change it?

我只想制作自定义条形码边框

I just want to make the customize barcode border

推荐答案

只需将#00000000设置为app:zxing_viewfinder_mask的值,然后添加包含该蒙版的ImageView

Just set #00000000 as value of app:zxing_viewfinder_mask, and add an ImageView that contain the mask

app:zxing_viewfinder_mask="#00000000"

这篇关于如何通过ViewFinder自定义zxing条码扫描器的捕获屏幕边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆