I have used surfaceview (Android 2.2 and above) in that if i make following code in AndroidManifest.xml the result would be fine
<activity
android:name="com.custom.camera.CustomCamera"
android:screenOrientation="landscape" >
</activity>
but if i use below code the camera view is not displaying
<activity
android:name="com.custom.camera.CustomCamera"
android:screenOrientation="portrait" >
</activity>
The picture with landscape mode which working fine is
same picture if i use in portrait mode will become
can anybody suggest me why this is happening
the xml file is
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/mPreview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="@+id/overlay_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:visibility="visible" >
<Button
android:id="@+id/mTakePicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Take Picture" />
<ImageView
android:id="@+id/mFrontView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</FrameLayout>
LOGCAT ISSUE
if it is in portrait mode i am getting error like below
12-16 15:43:09.297: E/Camera(7104): Error 1
12-16 15:43:15.297: E/Camera(7104): Error 1
12-16 15:43:21.307: E/Camera(7104): Error 1
12-16 15:43:27.337: E/Camera(7104): Error 1
in landscape it's working fine
1)You have to make your own custom view with all your logics and design in a separate class which extends View
2) The SurfaceView must be placed inside a Frame or RelativeLayout
3) Finally your custom view must be specified in your layout xml as a child
It will take some time but you have lot of examples and tutorials
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.