Make a Panel (declared as B4XView) as the first view in your Layout.
Make it big as the whole layout/display.
Put yout layout inside this panel.
When you need the Screenshot call
dim b as B4XBitmap = Panel1.Snapshot 'Supposing the Panel is called Panel1
and then save the bitmap where you need.
This is for Activity project, that should be avoided nowadays.
If you make a B4XPages project it will be even more simple.
No need to make all the things about the transparent panel.
Just call
dim b as B4XBitmap = Root.Snapshot