Draw a scaled bitmap to the canvas?

前端 未结 2 1868
轻奢々
轻奢々 2021-02-05 10:15

The following code defines my bitmap:

Resources res = context.getResources();

    mBackground = BitmapFactory.decodeResource(res,
            R.drawable.bg2);

         


        
2条回答
  •  抹茶落季
    2021-02-05 11:10

    To draw the scaled bitmap you want save your scaled bitmap in a field somewhere (here called mScaled) and call:

        c.drawBitmap(mScaled,0,0,null);
    

    in your draw method (or wherever you call it right now).

提交回复
热议问题