마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

비트맵 이미지 리사이징 관련해서 질문드립니다.

0 추천
리사이징 함수는 아래 소스와 같이 구현하였습니다. 기기별로 테스트 해보고 있는데 일반적인 해상도는 잘 리사이징 되어 보여지는데 갤럭시s4(1920*1080)에서는 이미지가 아주 작아져서 출력됩니다.  무엇때문에 그렇게 출력되는지 모르겠습니다.   
 
  <ImageView
                    android:id="@+id/intro"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:maxWidth="200dp"
                    android:maxHeight="200dp"
                    android:layout_weight="1"
                    android:adjustViewBounds="true"
 
                    />
------------------------------------------------------------------------------------------------------
public Bitmap resizeBitmapImage(Bitmap source, int maxResolution){
        int width = source.getWidth();
        int height = source.getHeight();
        int newWidth = width;
        int newHeight = height;
        float rate = 0.0f;
 
        if(width > height)
        {
            if(maxResolution < width)
            {
                rate = maxResolution / (float) width;
                newHeight = (int) (height * rate);
                newWidth = maxResolution;
            }
        }
        else
        {
            if(maxResolution < height)
            {
                rate = maxResolution / (float) height;
                newWidth = (int) (width * rate);
                newHeight = maxResolution;
            }
        }
        //imgView.setImageDrawable(Bitmap.createScaledBitmap(source, newWidth, newHeight, true));
        return Bitmap.createScaledBitmap(source, newWidth, newHeight, true);
    }
 
 
니키니트 (160 포인트) 님이 2013년 8월 30일 질문

1개의 답변

0 추천
해상도 때문입니다. dpi를 계산해서 고해상도의 경우 더 높은 ex) 200dp ~> 300dp의 이미지를 보여주게 하세요
쿵뿌팬더 (3,440 포인트) 님이 2013년 9월 1일 답변
...