Because the display control of Android software requires that the length exceed a certain value to be truncated and added with a ellipsis, this method is written:
Package COM. eoeandroid. demo. testcode; import android. app. activity; import android. graphics. bitmap; import android. graphics. bitmapfactory; import android. graphics. matrix; import android. graphics. drawable. bitmapdrawable; import android. OS. bundle; import android. view. viewgroup. layoutparams; import android. widget. imageview; import android. widget. linearlayout; import android. widget. imageview. scaletype; public class bitmaptest extends activity {public void oncreate (bundle icicle) {super. oncreate (icicle); settitle ("eoeandroid Tutorial: Zoom and rotate image-by: iceskysl"); linearlayout linlayout = new linearlayout (this); // load the image to be operated, here is the eoeandroid logo image bitmap bitmaporg = bitmapfactory. decoderesource (getresources (), R. drawable. eoe_android); // get the width and height of the image. Int width = bitmaporg. getwidth (); int Height = bitmaporg. getheight (); // defines the width and height of the pre-converted image. Int newwidth = 200; int newheight = 200; // calculates the scaling rate, new dimensions except original dimensions float scalewidth = (float) newwidth)/width; float scaleheight = (float) newheight)/height; // create a matrix object for image operations. Matrix matrix = new matrix (); // scale the image action matrix. postscale (scalewidth, scaleheight); // rotate the image action matrix. postrotate (45); // create a new image bitmap resizedbitmap = bitmap. createbitmap (bitmaporg, 0, 0, width, height, matrix, true); // converts the bitmap created above to a drawable object so that it can be used in imageview, in imagebutton, bitmapdrawable BMI = new bitmapdrawable (resizedbitmap); // create an imageview = new imageview (this); // set the imageview image to the image imageview converted above. setimagedrawable (BMI); // center the image and display the imageview. setscaletype (scaletype. center); // Add the imageview to the layout template. addview (imageview, new linearlayout. layoutparams (layoutparams. fill_parent, layoutparams. fill_parent); // set setcontentview (linlayout) as the template of this activity );}}