Android : Stop image scaling down

后端 未结 3 667
有刺的猬
有刺的猬 2020-12-17 00:04

I\'m trying to draw an image in a view but having problems trying to maintain the scale of the original image. Basically, I have a small view and I would like to show part o

3条回答
  •  攒了一身酷
    2020-12-17 01:07

    This probably won't be the most efficient way, but if you're not going to be moving it too much, it'll do. Treat it like a spritesheet, use Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height) to get the section you want from the original bitmap as its own bitmap, then pass that in instead. Then pass that in rather than the whole bitmap, and it'll only be working with the part you want it to show.

提交回复
热议问题