android - Camera preview not working on layout using ConstraintLayout/Guidelines -
i'm trying create custom barcode scanner ui using zxing android embedded
(https://github.com/journeyapps/zxing-android-embedded), camera preview not render anything, rectangle , laser rendered.
is there known issue or mistake in code?
activity
<android.support.constraint.constraintlayout 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" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.fcagroup.abtrace.activities.scanneractivity" android:id="@+id/fullscreen_content" android:descendantfocusability="beforedescendants" android:focusableintouchmode="true"> <android.support.constraint.guideline android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/guideline" android:orientation="horizontal" app:layout_constraintguide_percent="0.85" tools:layout_editor_absolutey="482dp" tools:layout_editor_absolutex="0dp" /> <android.support.constraint.constraintlayout android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintbottom_tobottomof="parent" app:layout_constraintleft_toleftof="parent" app:layout_constrainttop_totopof="@+id/guideline" app:layout_constraintright_torightof="parent" app:layout_constrainthorizontal_bias="1.0" app:layout_constraintvertical_bias="1.0" android:background="@color/black_overlay"> <edittext android:id="@+id/edittext" android:layout_width="0dp" android:layout_height="wrap_content" android:ems="10" android:inputtype="textpersonname" android:text="name" app:layout_constraintbottom_tobottomof="parent" android:layout_marginbottom="6dp" android:layout_marginleft="8dp" app:layout_constraintleft_toleftof="parent" app:layout_constraintright_toleftof="@+id/button" android:layout_marginright="8dp" app:layout_constrainthorizontal_bias="0.508" android:layout_marginstart="8dp" android:layout_marginend="8dp" /> <button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" android:layout_marginright="8dp" app:layout_constraintright_torightof="parent" app:layout_constraintbottom_tobottomof="parent" android:layout_marginbottom="8dp" android:layout_marginend="8dp" /> <textview android:id="@+id/textview" android:layout_width="0dp" android:layout_height="wrap_content" android:text="textview" android:layout_marginright="8dp" app:layout_constraintright_torightof="parent" android:layout_marginleft="8dp" app:layout_constraintleft_toleftof="parent" app:layout_constrainttop_totopof="parent" android:layout_margintop="8dp" android:layout_marginbottom="8dp" app:layout_constraintbottom_totopof="@+id/edittext" android:layout_marginstart="8dp" android:layout_marginend="8dp" /> </android.support.constraint.constraintlayout> <relativelayout android:layout_width="0dp" android:layout_height="0dp" android:layout_marginleft="0dp" android:layout_marginright="0dp" android:layout_margintop="0dp" app:layout_constrainthorizontal_bias="0.0" app:layout_constraintleft_toleftof="parent" app:layout_constraintright_torightof="parent" app:layout_constrainttop_totopof="parent" android:layout_marginbottom="0dp" app:layout_constraintbottom_totopof="@+id/guideline"> <com.journeyapps.barcodescanner.decoratedbarcodeview android:id="@+id/zxing_barcode_scanner" android:layout_width="match_parent" android:layout_height="match_parent" app:zxing_scanner_layout="@layout/custom_barcode_scanner" /> </relativelayout> </android.support.constraint.constraintlayout>
custom_barcode_scanner layout
<?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"> <com.journeyapps.barcodescanner.barcodeview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/zxing_barcode_surface" app:zxing_framing_rect_width="250dp" app:zxing_framing_rect_height="50dp"/> <com.journeyapps.barcodescanner.viewfinderview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/zxing_viewfinder_view" 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"/> </merge>
here's how rendered (this code based on sample @ https://github.com/journeyapps/zxing-android-embedded/blob/master/sample/src/main/res/layout/activity_custom_scanner.xml):
Comments
Post a Comment