I actually work on an Game and need some backup because Canvas.
I draw a background with canvas. So i made Picture exactly for the resolution of the screen we work on. On the device the picture is to small and dont fitt to the screen. Did i miss something that the draw makes it smaller?
Here is some code
public class Map extends View{
int[][] mapArray = new int[32][18];
private Bitmap picture;
private Paint paint;
public Map(Context context){
//basic init map
super(context);
this.setPicture(BitmapFactory.decodeResource(context.getResources(), R.drawable.newmap2));
}
public Bitmap getPicture() {
return picture;
}
public void setPicture(Bitmap background) {
this.picture = background;
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(picture, 0, 0, paint);
}
Hope you can help me out
Best regards
Ben
Maybe you put the bitmap in a high dpi directory (e.g. res/drawable-xhdpi) and your device is of a lower dpi ? In this case the image is scaled down on open.
What you are doing is not safe, other devices will have other screen sizes.