开发者

ImageView not rotating

开发者 https://www.devze.com 2023-03-10 11:44 出处:网络
ImageView is not rotating ? ImageView arrow1; arrow1=(ImageView) findViewById(R.id.arrow1); Matrix mtx =开发者_JS百科 new Matrix();

ImageView is not rotating ?

ImageView arrow1;
arrow1  =(ImageView) findViewById(R.id.arrow1);
Matrix mtx =开发者_JS百科 new Matrix();
mtx.postRotate(90);
arrow1.setImageMatrix(mtx);

Any Suggestions?


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

精彩评论

暂无评论...
验证码 换一张
取 消