且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的:如何从缩放图像停止的Andr​​oid 1.6+

更新时间:2023-01-03 20:47:52

结束语与绘制对象位图的问题。该绘制对象缩放位图。而不是使用的绘制对象,指定位图的ImageView 直接用 imageView.setImageBitmap(位图)

I updated my build to build against Android 1.6, and now my bitmaps are scaled down on high density screens. I do NOT want this behavior. I gave this a shot:

http://blog.tomgibara.com/post/190539066/android-unscaled-bitmaps

but the images are STILL scaling, that is UNLESS I set them to a specific height & width. If I use wrap_content they are scaled down.

I have an image loader using the unscaled bitmap loader to create a drawable like so:

Bitmap bm = UnscaledBitmapLoader.loadFromResource(imageBufferInputStream);
drawable = new BitmapDrawable(bm);

which I later assign to an ImageView like so:

imageView.setImageDrawable( copyBitmapDrawable( (BitmapDrawable) drawable) );

Wrapping the bitmap with a Drawable is the problem. The Drawable scales the Bitmap. Instead of using a Drawable, assign the Bitmap to the ImageView directly using imageView.setImageBitmap(Bitmap).