title: Android custom layout design in main layout
body: <p>I have to add the QRCode scan layout in my main layout than calling the new activity to load the camera to scan. </p>
  
  <p>I already done that part using the ZXing library. So this I have created the layout like this. </p>
  
  <pre><code>&lt;RelativeLayout 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"&gt;
  
  &lt;SurfaceView
      android:id="@+id/preview_view"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;
  
  &lt;zxing.ViewfinderView
      android:id="@+id/viewfinder_view"
      android:layout_width="match_parent"
      android:layout_height="250dp"
      android:layout_centerInParent="true"
      android:padding="10dp" /&gt;
  
  
  &lt;TextView
      android:id="@+id/status_view"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom|center_horizontal"
      android:background="@color/transparent"
      android:text="@string/msg_default_status"
      android:textColor="@color/status_text"
      android:visibility="gone" /&gt;
  
  &lt;Button
      android:id="@+id/btn_cancel"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentEnd="true"
      android:layout_alignParentRight="true"
      android:layout_below="@+id/viewfinder_view"
      android:layout_gravity="bottom"
      android:layout_marginEnd="15dp"
      android:layout_marginRight="15dp"
      android:layout_marginTop="15dp"
      android:text="Cancel"
      android:visibility="gone" /&gt;
  
  &lt;!--&lt;/merge&gt;--&gt;
  </code></pre>
  
  <p></p>
  
  <p>Then I called the CaptureActivity from ZXing Lib, 
  If It's first time load the camera to scan then it will ask the permission and show this message. Sorry, the Android camera encountered a problem. You may need to restart the device.
  So 
   1. <strong>If I closed the camera then click the open camera button then it's working.</strong> 
   2. I need to create the custom layout for scanning like the below image screen. </p>
  
  <p>Thanks in advance. <a href="https://i.stack.imgur.com/zPm9z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zPm9z.png" alt="enter image description here"></a></p>