目标效果:
能简单的实现查看,变焦,拍照,显示等基本功能,但是依然有很多没解决的地方,比如变焦效果不明显,拍照和查看时距离不一样等。
1.activity_my_camera.xml页面设置布局。
activity_my_camera.xml页面:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyCameraActivity" >
<SurfaceView
android:id="@+id/svCamera"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<Button
android:id="@+id/btnClickMyCamera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="拍照" />
</RelativeLayout>
2.activity_result_picture.xml页面显示图片。
activity_result_picture.xml页面:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ResultPictureActivity" >
<ImageView
android:id="@