How To Add Redline In Camera Preview
Im trying to customize my camera in my project android scanner, where i can put red line in the middle of my camera and make my background transparent. mycurrent camera layout: I
Solution 1:
A simple way by playing with views.
just replace below code with your layout-xml file.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#1A237E"
android:orientation="vertical"
android:weightSum="1"
tools:context="com.example.administrator.myapplication.CameraTestActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:orientation="horizontal"
android:weightSum="1">
</LinearLayout>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#1A237E"
android:text="Help"
android:textColor="#ffff"
android:textSize="15sp"
android:textStyle="italic" />
<TextView
android:id="@+id/textView8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.07"
android:text="ASEC MOBILE SCANNER"
android:textAlignment="center"
android:textColor="#ffff"
android:textSize="30sp"
android:textStyle="bold"></TextView>
<TextView
android:id="@+id/scanText"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_weight="0.07"
android:text="Scanning..."
android:textAlignment="center"
android:textColor="#ffff"
android:textSize="30sp"></TextView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center">
<FrameLayout
android:id="@+id/cameraPreview"
android:layout_width="294dp"
android:layout_height="307dp" />
<View
android:layout_width="294dp"
android:layout_height="1dp"
android:layout_centerVertical="true"
android:background="#ff0000" />
</RelativeLayout>
Post a Comment for "How To Add Redline In Camera Preview"