请问各路大神,android 如何判断相册图片是横向还是纵向?android 相册图片横向纵向

解决方案 »

  1.   

    http://asysbang.com/forum.php?mod=viewthread&tid=58&extra=page%3D1
      

  2.   

    Activity.getRequestedOrientation()  
    http://developer.android.com/reference/android/app/Activity.html#getRequestedOrientation()三个参数 
    ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
    ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
    ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
      

  3.   

    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是什么?
      

  4.   

    c为查询mediaprovider数据库返回的cursor
      

  5.   

    int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
    用这个方法获取到orientation可以吗?
      

  6.   

    int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, -1);
    用这个方法获取到orientation可以吗?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获取的图片,我实在是没辙了