bitmap - How to create resizable ImageView in Android -
i want user of app able modify image @ run time. user should able modify image height , width tapping on corner of image-view , dragging illustrated in following diagram:
i have spent lot of time researching , found making sense of multitouch , resize large bitmap file scaled output file pinch zoom none of these quite match requirements.
currently resizing bitmap using below finction , changing width in onprogress change method of seekbar instead of frame. using function changing image size not working smooth.
public static bitmap decodefile(file f,int width,int hight){ try { //decode image size bitmapfactory.options o = new bitmapfactory.options(); o.injustdecodebounds = true; bitmapfactory.decodestream(new fileinputstream(f),null,o); //the new size want scale final int required_width=width; final int required_hight=hight; //find correct scale value. should power of 2. int scale=1; while(o.outwidth/scale/2>=required_width && o.outheight/scale/2>=required_hight) scale*=2; //decode insamplesize bitmapfactory.options o2 = new bitmapfactory.options(); o2.insamplesize=scale; return bitmapfactory.decodestream(new fileinputstream(f), null, o2); } catch (filenotfoundexception e) {} return null; }
update :
now working smoothly using drawing bitmap in canvas using accepted answer of this question .
now reaming part setting frame around image crop frame.
please me achieve this.
you can accomplish using library use cropimageview3 , set image in float drawable , done
Comments
Post a Comment