Skip to content

Instantly share code, notes, and snippets.

@tongoclinh
Created December 13, 2018 09:31
Show Gist options
  • Select an option

  • Save tongoclinh/00fe0d503a4e589dfad2a000195af7af to your computer and use it in GitHub Desktop.

Select an option

Save tongoclinh/00fe0d503a4e589dfad2a000195af7af to your computer and use it in GitHub Desktop.
mQRSurfaceView = new SurfaceView(this);
FrameLayout.LayoutParams lParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
lParams.leftMargin = 100;
lParams.topMargin = 0;
lParams.gravity = Gravity.TOP | Gravity.START;
mFrameLayout.addView(mQRSurfaceView, lParams);
mQRSurfaceView.setZOrderOnTop(true);
mQRSurfaceView.setZOrderMediaOverlay(true);
mQRSurfaceView.getHolder().setFixedSize(500, 768);
qrEader = new QREader.Builder(this, mQRSurfaceView, new QRDataListener() {
@Override
public void onDetected(final String data) {
Log.d("QREader", "Value : " + data);
}
}).facing(QREader.BACK_CAM)
.enableAutofocus(true)
.height(mQRSurfaceView.getHeight())
.width(mQRSurfaceView.getWidth())
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment