2010-08-25 100 views
0

将我的图像拖放到Eclipse中的drawable-hdpi文件夹中,当我将它们加载到程序中时,它们是原始大小的2/3。 (我的500x150 .png正在加载为333x100 .png) 有关如何为Android创建/加载图像的任何建议?在Android中显示PNG文件(正在调整图像大小)

private Bitmap mGrass; 
BitmapFactory.Options options = new BitmapFactory.Options(); 
options.inPreferredConfig = Bitmap.Config.ARGB_8888; 
mGrass = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.grass, options); 

canvas.drawBitmap(mGrass, 0, 0, noPaint); 

回答

0

什么是您使用的AVD [Android虚拟设备]的DPI?如果DPI是160,那么请将您的图像转换为mdpi,hdpi,以便DPI超过240的手机

+0

谢谢!我的AVD也出现了错误,这只会导致更多的混淆。 – Nasq 2010-08-25 19:36:42