2014-04-06 3 views
3

시작 크기 (Width1 및 Height1)의 뷰가 있습니다. 크기를 끝 크기 (Width2 및 Height2)로 변경하는 애니메이션을 만들고 싶습니다. ScaleAnimation에 대해 읽었지 만 배율 인수를 이해할 수는 없습니다. 다음과 같다Scale 방법 특정 크기로의 애니메이션

ScaleAnimation scaleAnimation = new ScaleAnimation(a, b, c, d); 

감사

답변

2

매개 변수 4 수레 ScaleAnimation 생성자의 :

fromX Horizontal scaling factor to apply at the start of the animation 
toX  Horizontal scaling factor to apply at the end of the animation 
fromY Vertical scaling factor to apply at the start of the animation 
toY  Vertical scaling factor to apply at the end of the animation 

당신은 생성자에 대한 & D C, A, B 나에게 값을 알려 주시기 바랍니다 수

모든 값은 float입니다. 픽셀 단위의 크기가 아니라 상대적인 비율 요소를 나타냅니다. 그래서 width1에서 width2로 확장하고 height1에서 height2에 당신은 설정해야합니다

ScaleAnimation scaleAnimation = 
    new ScaleAnimation(1f, 1f * width2/width1, 1f, 1f * height2/height1);