我知道是什么意思,关键是我的程序中,width和height是大于0的啊。源码如下:
                 Matrix mtx=new Matrix();
degree=Math.toDegrees(Math.atan(yy/xx));
                mtx.setRotate((float)degree, (float)x+bm.getWidth()/2, (float)y+bm.getHeight()/2);
Bitmap bm1=Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), mtx, false);//这句出错
canvas.drawBitmap(bm1,(float) x, (float)y, paint);

解决方案 »

  1.   

    你的mtx中存在负数值...打个断点,调试到mtx,参看其中的值,就知道问题出在哪里了
      

  2.   

    atan有可能返回负数 要取绝对值
    degree=Math.toDegrees(Math.abs(Math.atan(yy/xx)));
      

  3.   


    必须要有负数啊,没负数,atan取得值就不完整了。
      

  4.   

    求解答,bitmap作matrix缩放时提示width and height must be > 0 发现matrix矩阵中存在一个负数,何解?
      

  5.   

    在mtx.setRotate前面加上这一句。mtx.reset();