Android实现调用摄像头拍照与视频功能-创新互联

应用场景:

在北仑等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站建设、网站设计 网站设计制作按需定制开发,公司网站建设,企业网站建设,成都品牌网站建设,全网整合营销推广,成都外贸网站建设,北仑网站建设费用合理。

在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。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网页设计公司