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()
fromQRCodeReaderView
,DrawerLayout
andActivity.getWindow().getDecorView()
- Calling
.requestLayout()
and.invalidate()
of those views innew Handler().post(() -> ...)
viewStub.inflate().post(() -> drawer.getDrawerLayout().invalidate())