In my application I want ot use surfaceview to show the PreView from the camera, and show some tips on the view. I needn't to storage the image.I want to use FragmentActivity to achieve that. I am a novice, can you give me any tutorial? Thank you~
Asked
Active
Viewed 453 times
1 Answers
0
Try this xml. It contain 2 containers one for camera preview and other for hints whose background needs to be invisible to show the underlying camera preview inside FrameLayout which enables one container to be above the other.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/camera_preview_linear_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<SurfaceView
android:id="@+id/camera_preview_surface_view"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent">
</SurfaceView>
<Button
android:id="@+id/camera_takepicture_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Take picture">
</LinearLayout>
<LinearLayout
android:id="@+id/camera_preview_hints"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00000000"
android:orientation="vertical">
<!-- Your hint goes here-->
</LinearLayout>
</FrameLayout>

Fabin Paul
- 1,701
- 1
- 16
- 18