首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Android:按一定角度旋转imageview中的图片

Android:按一定角度旋转imageview中的图片
EN

Stack Overflow用户
提问于 2012-01-24 12:00:00
回答 18查看 343.4K关注 0票数 174

我正在使用下面的代码在ImageView中旋转一个角度的图像。有没有更简单、更简单的方法。

代码语言:javascript
复制
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);
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8981845

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档