2012-02-21 53 views
0

我正在开发android中的动画应用程序。 我在应用程序中有一个大的图像。 图像应该从屏幕中心开始。初始阶段图像尺寸会更大。在移动到屏幕左侧时,其大小应该会减小(即缩放应该发生)。图像不应该回到原来的位置。在动画之后,它应该放置在屏幕的左侧。如何使图像小于原始大小?

任何人都可以请帮忙。 感谢你。

+0

你的意思是要进行动画处理,调整了吗? – Shaheer 2012-02-21 12:37:51

+0

http://stackoverflow.com/questions/2243335/how-to-display-animated-images-in-android – Triode 2012-02-21 12:44:23

+0

我想使它更小,而不是它的原始大小,它应该向后移动,同时调整大小 – naleshmadur 2012-02-21 12:45:15

回答

0

如果我理解conrrectly要显示的图像,然后使其appers的大小来减少给人的影响是进入后台制作动画。

您需要使用ScaleAnimation http://developer.android.com/reference/android/view/animation/ScaleAnimation.html

关于机器人动画很好的教程,可以发现:从中心 http://www.hascode.com/2010/09/playing-around-with-the-android-animation-framework/#Scale_Animations

+0

感谢Orlymee,它的工作原理。图像在屏幕上缩放,但现在我想停止特定点的图像缩放,我怎么能做到这一点? – naleshmadur 2012-02-22 05:20:51

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

,你可以移动它的位置,通过翻译图像矩阵 – 2012-02-21 12:54:41

相关问题