Search code examples
androidandroid-layoutbarcodezxing

android studio - zxing barcode scanner - custom layout


I am opening the scanner like this

IntentIntegrator integrator = new IntentIntegrator(activity);
integrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
integrator.setPrompt(message);
integrator.setCameraId(0);
integrator.setBeepEnabled(false);
integrator.setBarcodeImageEnabled(false);
integrator.initiateScan();

How can I change the layout?

I want to add a button to the scanner view and also increase the font of the prompt.

Thanks!


Solution

  • If you want to use this library with a custom layout, you'll have to build the layout yourself. The IntentIntegrator just launch a default activity that is part of the library, there aren't much customization options there. You can have a look at the documentation here in order to learn how to embed their component into your own layout.

    Hope this helps!