android 判断获取相册图片是横向还是纵向

Elieend 2013-06-14 05:32:56
请问各路大神,android 如何判断相册图片是横向还是纵向?
...全文
527 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Elieend 2013-06-14
  • 打赏
  • 举报
回复
引用 5 楼 Elieend 的回复:
[quote=引用 4 楼 l417584711 的回复:] c为查询mediaprovider数据库返回的cursor
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); 用这个方法获取到orientation可以吗?[/quote] ExifInterface exifInterface = new ExifInterface(s); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); //int rotation = c.getInt(getColumnIndex(MediaStore.Images.ImageColumns.ORIENTATION)); if (orientation != 0) { im = new ImageView(this); bm = BitmapFactory.decodeFile(s, opts); im.setImageBitmap(bm); Matrix m = new Matrix(); m.setRotate(orientation); Bitmap transformed = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), m, true); } 能帮我看看这样写行吗?这不是用cursor获取的图片,我实在是没辙了
Elieend 2013-06-14
  • 打赏
  • 举报
回复
引用 4 楼 l417584711 的回复:
c为查询mediaprovider数据库返回的cursor
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1); 用这个方法获取到orientation可以吗?
aSysBang 2013-06-14
  • 打赏
  • 举报
回复
c为查询mediaprovider数据库返回的cursor
Elieend 2013-06-14
  • 打赏
  • 举报
回复
引用 1 楼 l417584711 的回复:
http://asysbang.com/forum.php?mod=viewthread&tid=58&extra=page%3D1
int rotation = c.getInt(c.getColumnIndex(MediaStore.Images.ImageColumns.ORIENTATION)); if (rotation != 0) { Bitmap bitmap = BitmapFactory.decodeFile(path); imageBefore.setImageBitmap(bitmap); Matrix m = new Matrix(); m.setRotate(rotation); Bitmap transformed = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true); return transformed; } 这个方法里的c是什么?
顾小林 2013-06-14
  • 打赏
  • 举报
回复
Activity.getRequestedOrientation() http://developer.android.com/reference/android/app/Activity.html#getRequestedOrientation() 三个参数 ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
aSysBang 2013-06-14
  • 打赏
  • 举报
回复
http://asysbang.com/forum.php?mod=viewthread&tid=58&extra=page%3D1

80,354

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧