应用场景:
在Android开发过程中,有时需要调用手机自身设备的功能,上篇文章主要侧重摄像头拍照功能的调用。本篇文章将综合实现拍照与视频的操作。
知识点介绍:
该部分请阅读 【Android 调用摄像头功能】
使用方式:
第一步:
新建一个Android项目CameraPhotoVedio,包含两个Activity: MainActivity、CameraActivity。
第二步:
activity_main.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" android:background="@drawable/shape_main" tools:context=".MainActivity" > <LinearLayout android:layout_height="wrap_content" android:layout_marginTop="50dp" android:layout_width="match_parent" android:orientation="vertical"> <ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:src="@drawable/main"/> </LinearLayout> <LinearLayout android:layout_height="wrap_content" android:layout_marginTop="100dp" android:layout_width="match_parent" android:layout_alignParentBottom="true" android:orientation="vertical"> <Button android:id="@+id/main_button" android:layout_height="50dp" android:layout_marginBottom="50dp" android:background="@drawable/shape_main" android:layout_width="match_parent" android:textColor="#FFFFFF" android:text="使用摄像头"/> </LinearLayout> </RelativeLayout>
分享文章:Android实现调用摄像头拍照与视频功能-创新互联
标题来源:https://www.cdcxhl.com/article32/dhdspc.html
成都网站建设公司_创新互联,为您提供域名注册、微信公众号、营销型网站建设、Google、网站内链、软件开发
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联