上一篇博客我分享关于android如何获取Camera的方法
这次我来分享android通过Camera来录制视频: 点击获取源代码
1.先设置获取Camera 和 Aideo和sd存储卡的权限。(注:如果使用的是android studio的话把代码放到 之后之前,不然,会报错,因为获取不到权限)
2.创建布局文件:(注:最主要的是创建Surfaceview控件,因为他是用来接收由Camera传回来的数据的)
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.xiao.cameratesttwo.MainActivity">
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/surfaceview"/>
android:id="@+id/btn_paizhao"
android:text="录制"
android:layout_wi