Reputation: 33
I have implemented the class and draw in canvas in xml. But I am facing blank space at the bottom of the UI. How can I solve this problem?? I use to draw a drawable on the canvas. The class name is BarcodeScannerView. Here is the code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".ui.scanqrcode.BarcodeReaderActivity">
<include layout="@layout/toolbar_base" />
<SurfaceView
android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
<TextView
android:id="@+id/txtBarcodeValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:text="No Barcode Detected"
android:textColor="@android:color/white"
android:textSize="20sp" />
<com.tech.denTech.utils.QRCodeScannerView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView
android:id="@+id/txtScanCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Scan QR code"
android:layout_margin="@dimen/activity_vertical_margin_8dp"
android:layout_above="@id/ivScannerIcon"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_16sp" />
<ImageView
android:id="@+id/ivScannerIcon"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/activity_horizontal_margin_32dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_qr"
android:layout_centerHorizontal="true"
/>
</RelativeLayout>
You can go through this google link for screenshot:
https://drive.google.com/file/d/1KEQWjvubjlXs5hSENaShW9ErM84VXKY5/view?usp=sharing
Upvotes: 2
Views: 89
Reputation: 76496
You can use the Hierarchy Viewer to investigate:
https://developer.android.com/studio/profile/hierarchy-viewer
Then you can click on Views to understand what is what.
You can also look at the layout preview, to see which Views are taking up that space (if any):
Upvotes: 1