Search code examples
androidandroid-layoutandroid-camerabarcode-scanner

Camera layout bug


I'm using a barcode scanner library wich uses a camera layout, the usual. I tried the library on three devices and it looks fine in all of them.

enter image description here

But in the fourth device, it looks like this.

enter image description here

I uploaded pictures instead screenshots because, when you make one, the bug doesn't appears on it. It just looks normal. This makes me think about some kind of GPU/Android bug or something like that, but I really don't know where this is coming from and how to fix it.

By the way, the devices I used testing are: Nexus 5 (6.0.1), Galaxy Young (4.1.2) and Doogee DG685 (4.2.2). In all of them the layout is perfectly showed. The bug only appears on a HoneyWell E70 (4.0.3).


Solution

  • Author has explained to me that it's caused by using SurfaceView instead of SurfaceTexture.

    The library has a XML attribute to fix it:

    app:zxing_use_texture_view="true"
    

    But it's not documented. In the next release this option will be true by default.