Android:在图像视图中按角度旋转图像我使用下面的代码旋转图像在图像视图的角度。是否有更简单和不那么复杂的方法可用。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 rotatedBitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0,bMap.getWidth(),bMap.getHeight(), mat, true);iv.setImageBitmap(bMapRotate);
3 回答
呼啦一阵风
TA贡献1802条经验 获得超6个赞
ImageView
:
最新情况:
import android.graphics.Matrix;import android.widget.ImageView;
imageView
, angle
, pivotX
& pivotY
Matrix matrix = new Matrix();imageView.setScaleType(ImageView.ScaleType.MATRIX); //requiredmatrix.postRotate((float) angle, pivotX, pivotY);imageView.setImageMatrix(matrix);
注意:旋转 ImageView
在……上面 OnTouch在运行时,您可以设置 onTouchListener在……上面 ImageView
并通过增加最后两行来旋转它。 后旋转矩阵&设置它 图像视图)在上面的代码部分中,您的触摸侦听器 动作移动部分。
慕虎7371278
TA贡献1802条经验 获得超4个赞
android:rotation="90"
- 3 回答
- 0 关注
- 1032 浏览
添加回答
举报
0/150
提交
取消