2012-02-21 4 views
0

나는 안드로이드에 애니메이션 앱을 개발 중이다. 응용 프로그램에 큰 이미지가 하나 있습니다. 이미지가 화면 가운데에서 시작해야합니다. 이미지 크기는 초기 단계에서 더 커집니다. 화면 왼쪽으로 이동하는 동안 화면의 크기가 작아집니다 (즉, 비율 조정이 발생해야 함). 이미지가 원래 위치로 돌아 가지 않아야합니다. 애니메이션 후 화면 왼쪽에 배치해야합니다.원본 크기가 아닌 이미지를 작게 만드는 방법은 무엇입니까?

아무도 도와 줄 수 있습니까? 감사합니다. 난 당신이 이미지를 표시 한 다음이가 그 배경으로가는 영향을주는 크기가 감소 될 appers 있도록 애니메이션을 할 conrrectly 이해한다면

+0

센터에서 애니메이션 사이즈 변경? – Shaheer

+0

http://stackoverflow.com/questions/2243335/how-to-display-animated-images-in-android – Triode

+0

크기를 원래 크기보다 작게 만들고 크기를 조정할 때 뒤로 이동해야합니다. – naleshmadur

답변

0

크기를 조정합니다.

당신은 http://developer.android.com/reference/android/view/animation/ScaleAnimation.html

안드로이드 애니메이션에 대한 좋은 튜토리얼에서 찾을 수 있습니다 ScaleAnimation을 사용할 필요가 : 당신은 당신이하고 싶은 말은 http://www.hascode.com/2010/09/playing-around-with-the-android-animation-framework/#Scale_Animations

+0

에 의해 이미지를 번역하여 위치를 이동할 수 있습니다. 오렐리가 작동합니다. 이미지가 화면에 스케일링하지만 지금은 특정 지점에서 이미지 스케일링을 멈추고 싶습니다. 어떻게해야합니까? – naleshmadur

0

이 기능은 비트 맵

public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { 

    int width = bm.getWidth(); 
    int height = bm.getHeight(); 
    float scaleWidth = ((float) newWidth)/width; 
    float scaleHeight = ((float) newHeight)/height; 
    // create a matrix for the manipulation 
    Matrix matrix = new Matrix(); 
    // resize the bit map 

    matrix.postScale(scaleWidth, scaleHeight); 
    matrix.postRotate(90); 
    // recreate the new Bitmap 
    Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, 
      matrix, false); 
    ByteArrayOutputStream bytes = new ByteArrayOutputStream(); 
    resizedBitmap.compress(Bitmap.CompressFormat.PNG, 70, bytes); 

    return resizedBitmap; 

} 
+0

에서 뒤로 이동해야하며 u는 행렬 –

관련 문제