简体   繁体   English

ImageView 不旋转

[英]ImageView not rotating

ImageView is not rotating? ImageView不旋转?

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

Any Suggestions?有什么建议么?

Check This: http://www.androidpeople.com/android-image-rotate-example检查这个: http://www.androidpeople.com/android-image-rotate-example

I think it may help you我想它可以帮助你

Now Image rotating现在图像旋转

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM