1

In my project I'm using this material drawer lib of version 5.0.0 and this QR code reader lib of version 2.0.1. XML layout has the following structure:

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ViewStub
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout="@layout/include_qr_reader" />

    <Toolbar
        android:id="@+id/toolbar"
        ... 
        />

    ...

</FrameLayout>

Here @layout/include_qr_reader is just a view:

<com.dlazaro66.qrcodereaderview.QRCodeReaderView 
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

In my activity class first I'm checking camera permissions and if granted I just call viewStub.inflate(). In result my drawer gets cropped as seen in the image below:

After the view gets updated (some button clicked) the drawer gets back to normal.

And also LayoutInspector says all ok:

If you need more info on this case just let me know in the comments section.

Question

Why does my DrawerLayout gets cropped at the bottom when camera is active?

I've already tried:

  • Changing layout params of drawer in code after .inflate()
  • Changing layout params of qrreaderview in code after .inflate()
  • Calling .requestLayout() and .invalidate() from QRCodeReaderView, DrawerLayout and Activity.getWindow().getDecorView()
  • Calling .requestLayout() and .invalidate() of those views in new Handler().post(() -> ...)
  • viewStub.inflate().post(() -> drawer.getDrawerLayout().invalidate())
GV_FiQst
  • 1,487
  • 14
  • 30
  • The layout itself looks correct. also the view hierarchy, hmmm I can only assume that perhaps the `SurfaceView` or `TextureView` for the camera preview is in the wrong level. does that QR code reader lib offer anything to switch between those? – mikepenz Oct 16 '18 at 08:06
  • @mikepenz no. It just offers a custom view that I should use. – GV_FiQst Oct 22 '18 at 12:25

0 Answers0