【bug】:Bitmap.createScaledBitmap不能满屏
2015-04-27 14:35
573 查看
缩放一个 Bitmap
可以用 Bitmap.createScaledBitmap() 方 法根据给定的 Bitmap 创建 一个新的,缩放后的 Bitmap (该方法可以将一个Bitmap生成指定大小的BItmap,该方法可以放大图片也可以缩小图片。)
Bitmap mBitmap = Bitmap.createScaledBitmap(bmp, mScreenWidth, mScreenHeight, true);
其中 mScreenWidth 和 mScreenHeight 是屏幕的宽度和高度,这里就将 bmp 拉伸到整个屏幕。
Creates a new bitmap, scaled from an existing bitmap.
Parameters
What does the filter parameter to createScaledBitmap do? (来自stackoverflow.com)
解决;imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setImageBitmap(mBitmap);
可以用 Bitmap.createScaledBitmap() 方 法根据给定的 Bitmap 创建 一个新的,缩放后的 Bitmap (该方法可以将一个Bitmap生成指定大小的BItmap,该方法可以放大图片也可以缩小图片。)
Bitmap mBitmap = Bitmap.createScaledBitmap(bmp, mScreenWidth, mScreenHeight, true);
其中 mScreenWidth 和 mScreenHeight 是屏幕的宽度和高度,这里就将 bmp 拉伸到整个屏幕。
public static Bitmap createScaledBitmap (Bitmap src,
int dstWidth, int dstHeight, boolean filter)
Creates a new bitmap, scaled from an existing bitmap.Parameters
src | The source bitmap. |
---|---|
dstWidth | The new bitmap's desired width. |
dstHeight | The new bitmap's desired height. |
filter | true if the source should be filtered.(filter决定是否平滑,如果是缩小图片,filter无影响) |
解决;imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setImageBitmap(mBitmap);
相关文章推荐
- public static Bitmap createScaledBitmap(
- public static Bitmap createScaledBitmap(Bitmap unscaledBitmap, int dstWidth, int dstHeight,
- bitmap_createScaledBitmap的方法
- Bitmap.createScaledBitmap的陷阱
- bitmap的createScaledBitmap();(转)
- Bitmap.createScaledBitmap的陷阱
- SAP-ABAP-BAPI 调试 SHP_DELIVERY_CREATE_FROM_STO 的 bug
- ASP.NET自定义控件的BUG在ASPX页面中注册控件后不能打出标签的问题(本人已解决)
- PhpStorm 2016.3 For Mac 重大里程碑更新 -- 终于解决了不能输入中文标点符号的重大bug
- error C2664: “CButton::Create”: 不能将参数 1 从“const char [5]”转换为“LPCTSTR”
- eclipse中svn插件突然出现错误,不能连接svn了:Could not create the view: org.tigris.subversion.subclipse.ui.repositor
- 一次内存不能为read/write的bug解决经历
- iPhone真不能买!媒体曝光其68个Bug
- N97 SDk ColorUtils::CreateGradientBitmapL 画渐变问题。
- 解决安装mysql-connector-odbc-5.3.2 错误1918……不能加载安装或转换器库……的BUG
- VC++ TRACE Bug Trace所能接收的数据长度不能大于508字符
- Django model default=datetime.datetime.now() & get_or_create 一个BUG?!
- jquery的clone方法应用于textarea和select的bug修复不能copy值,clone id重复的解决
- firefox ie chrome 设置单元格宽度 td width 有bug,不能正常工作。以下方式可以解决
- urlrewriter--XP下IIS不能添加扩展名映射的BUG(.*)