gpt4 book ai didi

java - ImageView 不旋转

转载 作者:行者123 更新时间:2023-12-01 15:50:08 25 4
gpt4 key购买 nike

ImageView 没有旋转?

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

有什么建议吗?

最佳答案

现在图像旋转

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

关于java - ImageView 不旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6250779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com