android how to add marker on image? -
i need add marker on specific pixel on image how can ideas , need make action when clicked on image read article didn't know how start it
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { svg svg; switch (mnum) { case 1: svg = svgparser.getsvgfromresource(getresources(), r.raw.t1); break; case 2: svg = svgparser.getsvgfromresource(getresources(), r.raw.t2); break; case 3: svg = svgparser.getsvgfromresource(getresources(), r.raw.t3); break; case 4: svg = svgparser.getsvgfromresource(getresources(), r.raw.t4); break; default: svg = svgparser.getsvgfromresource(getresources(), r.raw.android); } view v = inflater.inflate(r.layout.hello_world, container, false); view tv = v.findviewbyid(r.id.text); imageview = (gestureimageview) v.findviewbyid(r.id.imageview1); imageview.setstrict(false); imageview.setstartingscale(lastscale); // if(lastxposition!=0 && lastyposition!=0) imageview.setstartingposition(lastxposition, lastyposition); // log.i("tag", // "lastxposition" + lastxposition); // log.i("tag", // "lastyposition" + lastyposition); // log.i("tag", // "lastscale" + lastscale); // imageview.setrotation(45); // imageview.setlayertype(view.layer_type_software, null); if (build.version.sdk_int > 15) imageview.setlayertype(view.layer_type_software, null); imageview.setimagedrawable(svg.createpicturedrawable()); ((textview) tv).settext("floor number: " + mnum); imageview.setbackgroundcolor(color.white); // tv.setbackgrounddrawable(getresources().getdrawable( // android.r.drawable.gallery_thumb)); // imageview.setscaletype(scaletype.center); // ((gestureimageview)imageview).setscale(x); return v; }
here suggestions , depend on needs
you should create own class extends imageview or whichever widget using hold image , override ondraw , there draw pixel wherever want.
if needs on more permanent pixel location. should create bitmap image , draw pixel , after assign bitmap whichever widget want.
if need move marker go first suggestion, , in opposite case second
hope helps , enjoy work.
Comments
Post a Comment