我正在从我的相机意图中拍摄图像,但问题是,即使我以纵向模式拍摄图像,它也会进入横向模式。
为了解决这个问题,我试图旋转图像,但是我收到了这个错误(下面提到)。
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
int screenWidth = getResources().getDisplayMetrics().widthPixels;
int screenHeight = getResources().getDisplayMetrics().heightPixels;
File imgFile = new File(pictureImagePath);
if(imgFile.exists()){
Bitmap bm = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
//Rotate image
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
// Notice that width and height are reversed
Bitmap scaled = ScalingUtilities.createScaledBitmap(bm, screenHeight, screenWidth, ScalingUtilities.ScalingLogic.FIT);
int w = scaled.getWidth();
int h = scaled.getHeight();
// Setting post rotate to 90
Matrix mtx = new Matrix();
mtx.postRotate(90); //Cannot resolve method 'postRotate(int)'
// Rotating Bitmap
bm = Bitmap.createBitmap(scaled, 0, 0, w, h, mtx, true);
}else{// LANDSCAPE MODE
//No need to reverse width and height
Bitmap scaled = ScalingUtilities.createScaledBitmap(bm, screenHeight, screenWidth, ScalingUtilities.ScalingLogic.FIT);
bm=scaled;
}
ImageView myImage = (ImageView) findViewById(R.id.imageView);
myImage.setImageBitmap(bm);
}
}
问题:mtx.postRotate(90);
显示:无法解析方法'postRotate(int)'
任何帮助?
随意建议编辑。感谢任何帮助。
答案 0 :(得分:4)
当SELECT u.*, i.minDepth FROM
Users AS u LEFT JOIN
(SELECT r.userId, min(r.depth) AS minDepth from Ratings AS r GROUP BY r.userId) AS i
ON u.userId=i.userId;
需要android.opengl.Matrix
时,您很可能导入Bitmap.createBitmap
。
这就是编译错误的原因。