ImageView不能旋转

时间:2011-06-06 10:35:48

标签: java android imageview

ImageView没有旋转?

ImageView arrow1;
arrow1  =(ImageView) findViewById(R.id.arrow1);
Matrix mtx = new Matrix();
mtx.postRotate(90);
arrow1.setImageMatrix(mtx);

任何建议?

2 个答案:

答案 0 :(得分:1)

选中此项:http://www.androidpeople.com/android-image-rotate-example

我认为它可以帮到你

答案 1 :(得分:0)

现在图像旋转

arrow1 = (ImageView) findViewById(R.id.arrow1);
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.arrow1);
bmpWidth = bitmap.getWidth();
bmpHeight = bitmap.getHeight();
float curScale = 1F;        
Matrix matrix = new Matrix();
matrix.postScale(curScale, curScale);
matrix.postRotate(90);  
if(resizedBitmap!=null){
 resizedBitmap.recycle();
}
resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bmpWidth, bmpHeight, matrix, true);
arrow1.setImageBitmap(resizedBitmap);
相关问题