TextureView官方Demo
来源:互联网 发布:淘宝明星zero距离签名 编辑:程序博客网 时间:2024/06/05 17:45
package com.*.*.activity;import android.graphics.SurfaceTexture;import android.hardware.Camera;import android.support.v7.app.ActionBar;import android.support.v7.widget.Toolbar;import android.view.TextureView;import com.<span style="font-family: Arial, Helvetica, sans-serif;">*.*</span><span style="font-family: Arial, Helvetica, sans-serif;">.R;</span>import java.io.IOException;import butterknife.Bind;public class TextureActivity extends BaseActivity implements TextureView.SurfaceTextureListener{ @Bind(R.id.toolbar) Toolbar mToolbar; @Bind(R.id.texture) TextureView mTexture; private Camera mCamera; @Override protected int getContentViewLayoutID() { return R.layout.activity_texture; } @Override protected void initView() { setSupportActionBar(mToolbar); ActionBar actionBar = getSupportActionBar(); if (null == actionBar) { return; } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle("Texture"); mTexture.setSurfaceTextureListener(this); } @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { mCamera = Camera.open(); try { mCamera.setPreviewTexture(surface); mCamera.startPreview();// mTexture.setAlpha(1.0f); mTexture.setRotation(90.0f);//控件旋转,90.0f代表顺时针旋转90度,因为正常的位图是逆时针90度的,ORZ... } catch (IOException ioe) { // Something bad happened } } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { // Ignored, Camera does all the work for us } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { mCamera.stopPreview(); mCamera.release(); return true; } @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { // Invoked every time there's a new Camera preview frame }}
0 0
- TextureView官方Demo
- TextureView
- TextureView
- 使用TextureView和SurfaceTexture预览Camera 基础拍照demo
- WS-Security官方 demo
- mxgraph-官方demo(1)
- datatables官方例子(demo)
- jqGrid Demo官方网
- 苹果官方demo
- FlexView Demo官方
- 苹果官方demo
- ios官方demo
- socket通讯官方demo
- Google官方demo(displayingBitmaps)
- ActivityLifeCycle官方demo解析
- iOS开发--官方demo
- iOS官方demo
- ios官方示例demo
- android launcher创建删除判断是否存在快捷方式
- UI基本知识
- web项目启动完成执行某个方法
- spring mvc test by mock
- online_judge_1011
- TextureView官方Demo
- apache mode_proxy反向代理tomcat
- jquery基础学习小例子
- 数学知识
- UIWebView之获取所点位置图片URL
- ajax post
- C++之动态链接库和静态链接库归纳…
- CoordinatorLayout和CollapsingToolbarLayout的基本使用方法
- CodeBlocks Package conficts