Android的:如何从缩放图像停止的Andr​​oid 1.6+ [英] Android: How to stop Android 1.6+ from scaling images

查看:130
本文介绍了Android的:如何从缩放图像停止的Andr​​oid 1.6+的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新了我的内部版本对Android 1.6的,现在我的位图上高密度的屏幕缩小。我不希望这种行为。我这给了一个镜头:

http://blog.tomgibara.com/post/190539066/android-未缩放,位图

但图像依然缩放,即除非我将它们设置为一个特定的高度和放大器;宽度。如果我使用 WRAP_CONTENT 他们正在缩小。

我必须使用缩放的位图加载器来创建一个可绘制的图像加载器,像这样:

 位图BM = UnscaledBitmapLoader.loadFromResource(imageBufferInputStream);
绘制=新BitmapDrawable(BM);
 

这是我后来分配给像这样一个ImageView的:

  imageView.setImageDrawable(copyBitmapDrawable((BitmapDrawable)绘制));
 

解决方案

结束语与绘制对象位图的问题。该绘制对象缩放位图。而不是使用的绘制对象,指定位图的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).

这篇关于Android的:如何从缩放图像停止的Andr​​oid 1.6+的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆