Closed michalkachel closed 9 years ago
Got same problem. +1
I'll have to look into this, should have some time next week.
:+1: Any progress?
Sorry, haven't had the time to look into this yet.
Ok, thanks for info.
Looks like problem appears on Sony Erricson Walkman WT19i (Android 4.0.4) even with windowTranslucentStatus==false
I have the same problem. When the toolbar is defined before the compoundbarcodeview then the surfacearea of the compoundbarcodeview just goes over the toolbar. We need to have a way to limit the surfacearea.
@michalkachel Thanks for the detailed report, sorry for only getting around to this now.
Devices typically have a fixed set of camera preview sizes. Quite often there won't be any with the exact aspect ratio that the BarcodeView has. Making the SurfaceView the same size as the BarcodeView would result in distortion of the aspect ratio, making the preview appear squashed.
Our workaround in the library is to make the SurfaceView larger than the BarcodeView in those cases. It is then effectively cropped by the views around it (or the visible screen area). In most cases it works quite well, but you have to be careful of the z-order of the components in some cases like this.
A simple workaround here is to use a RelativeLayout instead of LinearLayout, and define the Toolbar after the CompoundBarcodeView. This ensures that it stays on top.
I updated the sample using a RelativeLayout as decribed above. That seems to fix the issue.
This is not really a solution for me, as I have to implement the fragment below the toolbar without having the ability to influence the toolbar.
Somehow, if I add paddingTop to the compoundbarcodeview then the toolbar is still displayed.
How can we detect when the library uses that workaround from the compoundbarcodeview perspective?
Can you give more details on my you can't influence the layout or Toolbar?
This workaround will be applied in most cases, unless the size of the view matches one of the available preview sizes exactly. It is generally not an issue, as long as the views are in the proper z-order.
I work in a project in which there is a linearlayout with a toolbar first and a fragment-container below it. I cannot influence this layout as this is managed by another developer team, so I was wondering: how can I make sure that the toolbar will get on top of the preview again?
Since API level 21 you can use View#setZ(float).
I'm not aware of any other method to do this unfortunately. I suggest getting the other development team to change the layout, or using an alternative layout for this Activity.
Hi, When I launch ToolbarCaptureActivity from samples on Nexus 5 (5.1.1) with these modifications:
In sample/src/main/AndroidManifest.xml, screenOrienation set to portrait:
In sample/src/main/res/values-v21/styles.xml, added windowTransluscentStatus with true:
In sample/src/main/res/layout/capture_appcompat.xml, layout height changed to fixed value (also occures when weight is set and some other view is placed below):
The toolbar is totally covered by CompoundBarcodeView or disappears. I occured the same problem in my app and manged to achieve the same behaviour in sample. How can I fix it to still have windowTranslucentStatus set on true and determine CompoundBarcodeView height myself in portrait orientation?
Screen below: