Android ZXing QRコード読み込み画面に、白枠をつけるには?

バーコードの読み取りエリアは、150dp

<Framelayout>
    <RelaytiveLayout>
       barcode scan
    </RelativeLayout>
    <RelaytiveLayout>
       cross line
    </RelativeLayout>
</Framelayout>

xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

<RelativeLayout
    android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent">

    <com.journeyapps.barcodescanner.DecoratedBarcodeView
        android:id="@+id/barcode_scanner"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_above="@+id/buttonsLayout"
        app:zxing_scanner_layout="@layout/custom_barcode_scanner"
        android:layout_alignParentTop="true">

    </com.journeyapps.barcodescanner.DecoratedBarcodeView>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_alignParentBottom="true"
        android:id="@+id/buttonsLayout"
        android:layout_toLeftOf="@+id/centerHorizont">

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Pause"
            android:onClick="pause" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Resume"
            android:onClick="resume" />
    </LinearLayout>

    <View
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:id="@+id/centerHorizont" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:layout_toRightOf="@id/centerHorizont"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@id/buttonsLayout"
        android:id="@+id/barcodePreview" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignLeft="@+id/barcode_scanner"
        android:layout_alignParentTop="true"
        android:layout_alignStart="@+id/barcode_scanner"
        android:orientation="horizontal"></LinearLayout>

</RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_gravity="top"
        android:background="@android:color/white"
        android:orientation="vertical">

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="戻る" />
    </LinearLayout>

        <TextView
            android:id="@+id/qr_scan_message1"
            android:text="qr_scan_message1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/crossLineLayout"
            android:layout_marginBottom="50dp"
            android:layout_marginRight="30dp"
            android:layout_marginLeft="30dp"
            />

        <TextView
            android:id="@+id/qr_scan_message2"
            android:text="qr_scan_message2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/crossLineLayout"
            android:layout_marginTop="50dp"
            android:layout_marginRight="30dp"
            android:layout_marginLeft="30dp"
            />

    <!-- cross line -->
    <LinearLayout
        android:id="@+id/crossLineLayout"
        android:layout_width="153dp"
        android:layout_height="153dp"
        android:layout_centerInParent="true"
        android:orientation="vertical">

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/white" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:orientation="horizontal">

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

            <View
                android:layout_width="75dp"
                android:layout_height="match_parent"
                android:background="@android:color/transparent" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

            <View
                android:layout_width="75dp"
                android:layout_height="match_parent"
                android:background="@android:color/transparent" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/white" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="75dp"
            android:orientation="horizontal">

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

            <View
                android:layout_width="75dp"
                android:layout_height="match_parent"
                android:background="@android:color/transparent" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

            <View
                android:layout_width="75dp"
                android:layout_height="match_parent"
                android:background="@android:color/transparent" />

            <View
                android:layout_width="1dp"
                android:layout_height="match_parent"
                android:background="@android:color/white" />

        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:background="@android:color/white" />

    </LinearLayout>
</RelativeLayout>
</FrameLayout>

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha