Because BMP image is too large, imageview controls do not display properly, so I wanted to be converted to jpg BMP images displayed again, but just do not understand contacts, please God help me great. . Thank you<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
No matter what your image is set to the same format as long as the same size are accounted for in the same memory size ah
Format conversion can not solve your problem
You can create a miniature BitmapFactory bitmap display with ImageView
Reply:
I have thought of doing, you can teach under me? Thank you
Reply:
[Code = java / / Get the image width and height
BitmapFactory.Options opt = new BitmapFactory.Options ();
opt.inJustDecodeBounds = true;
try {
bitmapIn = BitmapFactory.decodeFile (Puzzle.user.CUSTOM_IMAGE [customImage], opt);
} Catch (Exception e) {
if (D) Log.d (TAG, "error");
return;
}
int in_w = opt.outWidth, in_h = opt.outHeight;
/ / Get the size imageview attention imageview to be the same with the original aspect ratio or need to be calculated separately
full_w = imageview.getWidth ()
full_h = getHeight ()
/ / Calculate the scaling with rounded
int Size_rate = (in_w * in_h * 10) / (full_w * full_h);
if (Size_rate> 10) {
Size_rate + = 5;
Size_rate / = 10;
} Else {
Size_rate = 1;
}
/ / Reset opt to read image files
opt.inSampleSize = Size_rate;
opt.inJustDecodeBounds = false;
opt.inScaled = false;
opt.outWidth = full_w;
opt.outHeight = full_h;
bitmapIn = BitmapFactory.decodeFile (Puzzle.user.CUSTOM_IMAGE [customImage], opt);} [/ code]
Reply:
Fat collapse retransmission
/ / Get the image width and height
BitmapFactory.Options opt = new BitmapFactory.Options ();
opt.inJustDecodeBounds = true;
try {
bitmapIn = BitmapFactory.decodeFile (Puzzle.user.CUSTOM_IMAGE [customImage], opt);
} Catch (Exception e) {
if (D) Log.d (TAG, "error");
return;
}
int in_w = opt.outWidth, in_h = opt.outHeight;
/ / Get the size imageview attention imageview to be the same with the original aspect ratio or need to be calculated separately
full_w = imageview.getWidth ()
full_h = getHeight ()
/ / Calculate the scaling with rounded
int Size_rate = (in_w * in_h * 10) / (full_w * full_h);
if (Size_rate> 10) {
Size_rate + = 5;
Size_rate / = 10;
} Else {
Size_rate = 1;
}
/ / Reset opt to read image files
opt.inSampleSize = Size_rate;
opt.inJustDecodeBounds = false;
opt.inScaled = false;
opt.outWidth = full_w;
opt.outHeight = full_h;
bitmapIn = BitmapFactory.decodeFile (Puzzle.user.CUSTOM_IMAGE [customImage], opt);}
Reply:
Puzzle.user.CUSTOM_IMAGE [customImage]
There should be a picture file path
This code is
SD card file readIf it is res picture files need to use
BitmapFactory.decodeResource (res, id, opt);
Method to replace
BitmapFactory.decodeFile (path, opt);
Method
Reply:
I tried, but the pictures do not show up, but I direct BitmapFactory.Options options = new BitmapFactory.Options ();
options.inJustDecodeBounds = false;
options.inSampleSize = 1;
Bitmap bitmap = BitmapFactory.decodeStream (is, null, options);
chlmapImageView.setImageBitmap (bitmap); show up, and there is the difference? If I want to show a part of, for example to a point on the map as the center to show it?
No comments:
Post a Comment