Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw four boundary corner for qr code scanner

Tags:

android

enter image description here

How to draw four Boundary for qrcode?

like image 494
Manmohan Avatar asked Jul 11 '16 06:07

Manmohan


People also ask

How many squares is a QR code?

The largest possible code, Version 40, allowed under the QR Code standard is a matrix of 177 × 177 pixels, and the smallest, Version 1, is 21 × 21 pixels. A Version 40 QR Code can contain 7,089 numeric characters or 4,296 alphanumeric characters.

Can QR codes be scanned at any angle?

Scanning a QR code using your device is straightforward: Open the QR reader application or the camera on your smartphone. Point it at the QR code – you should be able to point your camera from any angle and still receive the necessary information.

Is there a pattern to QR codes?

... of QR Code: it is like horizontal and vertical square set of black pattern on the white background, and it hold the data in a codified form which read or identify through the encoding program, like QR code reader software.

Can a QR code be a rectangle?

New rectangular QR Code from DENSO: rMQR Code is ideal for long and narrow spaces. DENSO introduces the new rMQR Code – the rectangular Micro QR Code. It can be printed in long, narrow spaces, while retaining the outstanding scan speed and data capacity of a conventional QR Code.


2 Answers

I created a vector drawable for this:

<vector 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="220dp" android:height="220dp" android:viewportHeight="230.0" android:viewportWidth="230.0">
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M165,5C178.2,5 198.2,5 225,5L225,30.79L225,65"
        android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M5,65C5,51.8 5,31.8 5,5L30.79,5L65,5"
        android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M165,225C178.2,225 198.2,225 225,225L225,199.21L225,165"
        android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M5,165C5,178.2 5,198.2 5,225L30.79,225L65,225"
        android:strokeColor="@color/qr_code_reader_square" android:strokeWidth="10"/>
</vector>

You can save it in res/drawable as qr_code_reader_square.xml and then use it in your layout like this:

<FrameLayout
    android:layout_width="250dp"
    android:layout_height="250dp"
    android:background="@drawable/qr_code_reader_square"/>

You will also have to set the color in res/values/colors.xml:

<color name="qr_code_reader_square">#FFFFFFFF</color>
like image 157
Franco Avatar answered Sep 19 '22 07:09

Franco


I shortened the edges. It looks better now.

<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="200dp" android:height="200dp" android:viewportHeight="230.0" android:viewportWidth="230.0">
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M200,5C197.1,5 198,5 225,5L225,30.79L225,6"
        android:strokeColor="@color/colorWhite" android:strokeWidth="2"/>
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M5,15C5,51.8 5,5 5,5L10.19,5L30,5"
        android:strokeColor="@color/colorWhite" android:strokeWidth="2"/>
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M200,225C200,225 200,225 225,225L225,200.21L225,200"
        android:strokeColor="@color/colorWhite" android:strokeWidth="2"/>
    <path android:fillColor="#00000000" android:fillType="evenOdd"
        android:pathData="M5,200C5,200 5,210 5,225L30.90,225L7,225"
        android:strokeColor="@color/colorWhite" android:strokeWidth="2"/>

</vector>

You should check down :

enter image description here

like image 28
Halil Ozel Avatar answered Sep 17 '22 07:09

Halil Ozel