Now how to tell for the SurfaceView
to be square, have the same height as ImageView
's width?
<RelativeLayout
android:id="@+id/rlQr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_below="@+id/rlTop">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ivScanTop"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:background="@drawable/qr_margin_top" />
<SurfaceView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_alignLeft="@+id/ivScanTop"
android:layout_alignRight="@+id/ivScanTop"/>