Showing Views in a Compose app
Imagine you have written a View-based custom component for one of your previous apps—for example, an image picker, a color chooser, or a camera preview—or you would like to include a third-party library such as Zebra Crossing (ZXing) to scan Quick Response (QR) codes and barcodes. To incorporate them into a Compose app, you need to add the View (or the root of a View hierarchy) to your composable functions.
Let's see how this works.
Adding custom components to a Compose app
The ZxingDemo
sample, shown in the following screenshot, uses the ZXing Android Embedded barcode scanner library for Android, which is based on the ZXing decoder. It is released under the terms of the Apache License 2.0 and is hosted on GitHub (https://github.com/journeyapps/zxing-android-embedded):
My example continuously scans for barcodes and QR codes. The decorated barcode view is provided...