无风子

Android之ImageView 旋转

  方案一:

    (1)获取ImageView对应的图片,并将其转成Bitmap;

    (2)创建Matrix对象;

    (3)调用matrix.setRotate(     );设置旋转度数

    (4)重新创建bitmap

    (5)ImageView设置ImageBitmap

        

      Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap();
      Matrix matrix = new Matrix();
      matrix.setRotate(progress);
      bitmap = Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),bitmap.getHeight(),matrix,true);
      imageView.setImageBitmap(bitmap);

posted on 2015-07-16 16:45  无风子  阅读(1371)  评论(0编辑  收藏  举报

导航