
我正在开发一个应用程序,我已经向用户提供了他可以使用他的移动相机拍照的设备,然后我在ImagevIEw中显示图像.
现在的问题是,如果我以纵向模式或横向模式捕获图像,它总是在ImageVIEw中以横向模式设置图像,但我希望图像仅在纵向模式下设置.请帮我解决这个问题.
任何帮助都会很明显……
谢谢
解决方法:
Matrix mat = new Matrix();ExifInterface exif = new ExifInterface(yourimagepath);String orIEntstring = exif.getAttribute(ExifInterface.TAG_ORIENTATION);int orIEntation = orIEntstring != null ? Integer.parseInt(orIEntstring) : ExifInterface.ORIENTATION_norMAL;int rotateangle = 0;if(orIEntation == ExifInterface.ORIENTATION_ROTATE_90) rotateangle = 90;if(orIEntation == ExifInterface.ORIENTATION_ROTATE_180) rotateangle = 180;if(orIEntation == ExifInterface.ORIENTATION_ROTATE_270) rotateangle = 270;mat.setRotate(rotateangle, (float) bmpPic.getWIDth() / 2, (float) bmpPic.getHeight() / 2);file f = new file(yourimagepath); Bitmap bmpPic = BitmapFactory.decodeStream(new fileinputStream(f), null, null); Bitmap bmpPic1 = Bitmap.createBitmap(bmpPic, 0, 0, bmpPic.getWIDth(), bmpPic.getHeight(), mat, true); 总结 以上是内存溢出为你收集整理的android – 如何在纵向模式下设置捕获的图像全部内容,希望文章能够帮你解决android – 如何在纵向模式下设置捕获的图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)