title: I would like to create custom PreviewView for barcode with cameraX
body: <p>I would like to create custom PreviewView for barcode with CameraX, I don't find enough resources for custom UI with CameraX.</p>
  <p><em><strong>Which custom classes should I implement (to make Custom UI) and how should I register the UI to CameraX preview?</strong></em></p>
  <p>// create preview usecase</p>
  <pre><code> val previewUseCase = Preview.Builder()
          .setTargetAspectRatio(screenAspectRatio)
          .setTargetRotation(previewView!!.display.rotation)
          .build()
  </code></pre>
  <p>//attach surfaceprovicer</p>
  <pre><code> previewUseCase!!.setSurfaceProvider(previewView!!.createSurfaceProvider())
  </code></pre>
  <p>// bind</p>
  <pre><code>cameraProvider!!.bindToLifecycle(/* lifecycleOwner= */this, cameraSelector!!, previewUseCase)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/udIdx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/udIdx.jpg" alt="I would like to create UI like that" /></a></p>