一个QR扫描仪的片段内 [英] A QR scanner inside of a Fragment

查看:139
本文介绍了一个QR扫描仪的片段内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用ViewPager我的片段之间刷卡。是否有可能集成QR扫描仪(zxing或任何其他)的片段里​​,这样我可以刷卡从扫描仪查看到另一个片段,反之亦然?

I'm using ViewPager for swiping between my Fragments. Is it possible to integrate a QR scanner (zxing or any other) inside of a Fragment so that I can swipe from scanners View to another Fragment and vice versa?

据我所知,大多数QR扫描仪要求我使用扩展的活动类,并启动它的结果,处理它on​​ActivityResult,这是不是一种选择,我

As far as I can tell, the majority of qr scanners require me to use an extended Activity class and to start it for result, handling it in onActivityResult, which is not an option to me

推荐答案

吧codefragmentlib 是您正在寻找的人。而其维基告诉您如何整合它(虽然我使用了不同的方法之前,维基出来)。

The barcodefragmentlib is the one you are looking for. And its wiki shows you how to integrate it (although I used a different way before the wiki comes out).

但是之后完全集成,并解决所有的问题,为我们的商业应用程序,我觉得自己像把一个QR扫描仪片段内切换使用ViewPager是不是一个好主意。一些已知问题这个想法和所提到的库我是:

However after fully integrated it and solve all the issues for our commercial app, I feel like put a QR scanner inside a fragment and switch using ViewPager is not a good idea. Some of the known issues with this idea and the mentioned library to me are:

  • 的QR片段与其他片段之间切换将会使你的应用程序延迟非常明显,容易死机;
  • 片段更换不是那么容易处理的活动,QR片段更是雪上加霜;
  • 在处理纵向/横向扫描模式不可用在默认情况下(与原来的ZXing LIB)
  • 当第一次打开QR片段,它可以黑掉你的屏幕在很短的时间
  • 在扫描仪无法正常工作的银河S4或其他新设备具有更高分辨率的摄像头/显示器

尽管上面提到的可以具有一定的努力来解决这些问题,这是一个真正的权衡。

Although these issues mentioned above can be solved with certain effort, it is really a trade off.

这篇关于一个QR扫描仪的片段内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆