How to Customize the capture screen border of zxing barcode scanner from ViewFinder

匿名 (未验证) 提交于 2019-12-03 09:06:55

问题:

 <?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>

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

回答1:

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

app:zxing_viewfinder_mask="#00000000"


回答2:

Actually you can override the color in your own colors.xml file i.e. <color name="viewfinder_border">#00d1cf</color>



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!