android摄像机自动聚焦

这是一个关于Android摄像机自动聚焦功能的测试应用,作者分享了查阅资料后的实现代码,包括布局文件、权限配置和Java代码,旨在帮助开发者理解并实现相机自动聚焦。源码可在指定链接获取。
摘要由CSDN通过智能技术生成

闲着无聊写的一个测试相机,查了各种资料希望对大家有帮助.

需要完整工程的可以到:https://git.oschina.net/mashuai1989/VideoTest.git下载

废话不多说了直接上代码

布局文件:

 <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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <SurfaceView 
        android:id="@+id/surfaceview"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
       />
   <Button
            android:layout_alignParentBottom="true"
       android:text="@string/start"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:id="@+id/start"/>
</RelativeLayout>

 

权限配置:

各种权限申请

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.videotest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="20" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.videotest.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值