问题:
I am using the following code to rotate a image in ImageView by an angle.我正在使用以下代码将 ImageView 中的图像旋转一个角度。 Is there any simpler and less complex method available.是否有任何更简单和更简单的方法可用。
ImageView iv = (ImageView)findViewById(imageviewid);
TextView tv = (TextView)findViewById(txtViewsid);
Matrix mat = new Matrix();
Bitmap bMap = BitmapFactory.decodeResource(getResources(),imageid);
mat.postRotate(Integer.parseInt(degree));===>angle to be rotated
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0,bMap.getWidth(),bMap.getHeight(), mat, true);
iv.setImageBitmap(bMapRotate);
解决方案:
参考一: https://en.stackoom.com/question/bgaT参考二: https://stackoom.com/question/bgaT