I'm a beginner Android developer working on a prototype app. I'm using a proprietary barcode scanner inside my app, and I want to overlay a small menu at the bottom of the screen while my barcode scanner is running. Ideally this menu would be sized roughly 1/5th of the screen and contain a few buttons. I've thought about using fragments to achieve this UI, but I'm having a hard time converting my scanner's SDK tutorial to use fragments.
Right now, my activity produces a full screen camera view with the barcode picker overlayed in the middle with the following code:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
requestWindowFeature(Window.FEATURE_NO_TITLE);
ScanditSDKAutoAdjustingBarcodePicker picker = new
ScanditSDKAutoAdjustingBarcodePicker(
this, sScanditSdkAppKey,ScanditSDKAutoAdjustingBarcodePicker.CAMERA_FACING_BACK);
setContentView(picker);
mBarcodePicker = picker;
How would I go about overlaying a menu that I can describe in an XML file with this setup? Invoking an XML layout via another setContentView() covers the whole screen, even when I set its background to transparent (or null).
Apologies in advance if this question is worded poorly.
I've checked documentation for this ScanditSDKAutoAdjustingBarcodePicker and found next link: http://docs.scandit.com/stable/android/android-scanview-options.html
As the BarcodePicker is a normal RelativeLayout you can add it to your own layout like any other view:
// Set app key. This will only have to be done once
ScanditLicense.setAppKey("yourAppKey");
// Create the scan view. Note that you will have to configure the settings in your app
// since the default settings have all symbologies disabled and you won't be able to
// scan anything.
BarcodePicker barcodePicker = new BarcodePicker(context, ScanSettings.create());
// Add the scan view to the root view.
rootView.addView(barcodePicker);
So you can have "ordinary" activity with layout, defined in XML. You can use RelativeLayout. There you can put container (FrameLayout) for picker and your menu, aligned to bottom of RelativeLayout. You can find container by id and put picker into that container with addView().