我在画布上显示了一个图像。下面是代码。当用户在各个方向拖动图像时,有没有办法动态拉伸或缩小图像?怎么接近它?
public class MainActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(new MyView(this));
}
public class MyView extends View
{
public MyView(Context context)
{
super(context);
}
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
Bitmap _scratch = BitmapFactory.decodeResource(getResources(), R.drawable.dog);
canvas.drawColor(Color.WHITE);
canvas.drawBitmap(_scratch, 0, 0, null);
}
}
}
答案 0 :(得分:0)