ZXing for Android 修改为竖屏模式
zxing github连接:https://github.com/zxing/zxing
以下为修改方法
Step 1: Add following lines to rotate data before buildLuminanceSource(..)
in decode(byte[] data, int width, int height)
DecodeHandler.java:
byte[] rotatedData =newbyte[data.length];
for(int y =0; y < height; y++){for(int x =0; x < width; x++)
rotatedData[x * height + height - y -1]= data[x + y * width];}
int tmp = width;
width = height;
height = tmp;
PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(rotatedData, width, height);
Step 2: Modify getFramingRectInPreview()
.
CameraManager.java
rect.left = rect.left * cameraResolution.y / screenResolution.x;
rect.right = rect.right * cameraResolution.y / screenResolution.x;
rect.top = rect.top * cameraResolution.x / screenResolution.y;
rect.bottom = rect.bottom * cameraResolution.x / screenResolution.y;
Step 3: Disable the check for Landscape Mode in initFromCameraParameters(...)
CameraConfigurationManager.java
//remove the following (下面代码新版本,应该是木有了)
if(width < height){Log.i(TAG,"Display reports portrait orientation; assuming this is incorrect");
int temp = width;
width = height;
height = temp;
}
Step 4: Add following line to rotate camera insetDesiredCameraParameters(...)
CameraConfigurationManager.java
camera.setDisplayOrientation(90);
Step 5: Do not forget to set orientation of activity to portrait. I.e: manifest
ZXing for Android 修改为竖屏模式的更多相关文章
- 【转】Android 模拟器横屏竖屏切换设置
http://blog.csdn.net/zanfeng/article/details/18355305# Android 模拟器横屏竖屏切换设置时间:2012-07-04 来源:设计与开发 ...
- Zxing二维码精简(竖屏、拉伸处理、扫描框大小和扫描线移动)
本帖最后由 levil_ad 于 2013-12-30 13:55 编辑 最近没事做了下二维码扫描,用的是ZXing的开源代码,官方源码地址:http://code.google.com/p/zxin ...
- Android 横屏切换竖屏Activity的生命周期(转)
曾经遇到过一个面试题,让你写出横屏切换竖屏Activity的生命周期.现在给大家分析一下他切换时具体的生命周期是怎么样的: 1.新建一个Activity,并把各个生命周期打印出来 2.运行Acti ...
- Android——横屏和竖屏的切换,以及明文密码的显示
查看API文档: android.content.pm.ActivityInfo 在手机的使用中,我们要根据不同的需求来改变屏幕的显示方向,一般在浏览信息时是竖屏,在玩游戏的时候就要切换到横屏. ...
- Android判断横屏竖屏代码
// 判断Android当前的屏幕是横屏还是竖屏.横竖屏判断 if (this.getResources().getConfiguration().orientation == Configurati ...
- Android 设置 横屏 竖屏 (转)
http://2960629.blog.51cto.com/2950629/701227 方法一:在AndroidManifest.xml中配置 如果不想让软件在横竖屏之间切换,最简单的办法就是在项目 ...
- Android 设置 横屏 竖屏
方法一:在AndroidManifest.xml中配置 如果不想让软件在横竖屏之间切换,最简单的办法就是在项目的AndroidManifest.xml中找到你所指定的activity中加上androi ...
- Android模拟器设置竖屏
使用Android模拟器測试自己开发的程序时,有时候会发现屏幕为横屏显示,查看效果非常不方便. 这里记录了一种禁止横屏的方法. 在文件 Mainfest.xml 中,在须要禁止横屏的 activit ...
- Android设置横屏竖屏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FUL ...
随机推荐
- hdu 1556(线段树之扫描线)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1556 Color the ball Time Limit: 9000/3000 MS (Java/Ot ...
- hdu 1395 2^x mod n = 1(暴力题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1395 2^x mod n = 1 Time Limit: 2000/1000 MS (Java/Oth ...
- 工程化管理--maven
mavne模型 可以看出 maven构件都是由插件支撑的 maven的插件位置在:F:\MavenRepository\org\apache\maven\plugins Maven仓库布局 本地仓库 ...
- php伪协议
文件包含函数:include.require.include_once.require_once.highlight_file .show_source .readfile .file_get_con ...
- 【Matlab】绘制饼状统计图
a=tabulate(b); % b为需要绘制饼图的原始数据列,生成新的一个矩阵a label={'1','2','3'} % 设定饼图每块扇形代表的内容 percent=num2str(a(:,3) ...
- python基础===创建大量对象是节省内存方法
问题: 你的程序要创建大量(可能上百万) 的对象,导致占用很大的内存. 解决方案: 对于主要是用来当成简单的数据结构的类而言,你可以通过给类添加__slots__属性来极大的减少实例所占的内存.比如: ...
- 解决sql server中批处理过程中“'CREATE/ALTER PROCEDURE 必须是查询批次中的第一个语句”
在批处理中加字段或表或视图或存储过程是否存在的判断 -----------------------------------------line----------------------------- ...
- 动画基础--基于Core Animation(3)
参考:https://zsisme.gitbooks.io/ios-/content/ 前面的文章动画基础--基于Core Animation(1),动画基础--基于Core Animation(2) ...
- HEER-Easing Embedding Learning by Comprehensive Transcription of Heterogeneous Information Networks
来源:KDD 2018 原文:HEER code:https://github.com/GentleZhu/HEER 注: 若有错误,欢迎指正 这篇KDD’18的文章,没有按照常规的方法将所有的n ...
- .vue,跟小程序文件在sublime里面怎么实现代码格式化
.vue文件跟小程序的.wxml,.wxss用sublime的HTML/CSS/JS prettify插件也可以实现格式化代码的效果 首先你在sublime要已经安装好了HTML/CSS/JS pre ...