layout - How to customize Scanner frame for android ZBar QrCode? -
i using library,https://github.com/dm77/zbarscanner
how customize size of scanner frame?
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate);
if(!iscameraavailable()) { // cancel request if there no rear-facing camera. cancelrequest(); return; } // hide window title. requestwindowfeature(window.feature_no_title); getwindow().addflags(windowmanager.layoutparams.flag_fullscreen); mautofocushandler = new handler(); // create , configure imagescanner; setupscanner(); // create relativelayout container hold surfaceview, // , set content of our activity. mpreview = new camerapreview(this, this, autofocuscb); setcontentview(mpreview); }
you wrap in framelayout:
mpreview = new camerapreview(this, this, autofocuscb); //create framelyout hold views framelayout layout = new framelayout(this); framelayout.layoutparams layoutparams=new framelayout.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.match_parent, gravity.center_horizontal|gravity.center_vertical); layout.setlayoutparams(layoutparams); //example of toolbar view add toolbar bar = (toolbar) layoutinflater.from(this).inflate(r.layout.toolbar_general, layout, false); layout.addview(mpreview);//add camerapreview layout.addview(bar);//<----add example toolbar //layout.addview(imageoverlay1);//<----this you'll add more views //layout.addview(imageoverlay2); setcontentview(layout);
hope helps.
Comments
Post a Comment