I have a Bitmap image in my ressources.
When i draw it using an ImageView, it doesn't have the same size as when I draw it on the canvas using Drawbitmap. No matter what density I use to my bitmap ( 160, 240 ), the bitmap is always zoomed. How to draw the bitmap so it has the same size as when I use an image开发者_JAVA百科view ?
The trick is to create a scaled bitmap and then draw.
my_bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.my_bitmap);
my_bitmap = Bitmap.createScaledBitmap(my_bitmap, screenWidth, screenHeight, true);
精彩评论