0
내 앱의보기에 애니메이션을 확대하고 있습니다. 사용자가 버튼을 클릭하면 다음 활동은 해당 버튼에서 확대됩니다. This은 아래 코드를 사용하여 얻은 것입니다.애니메이션 축소 - Android
위에서 언급 한 비디오에서 젤리 위 이상에서만 작동하는 코드는 아래 코드를 사용해야했습니다.
Next_Activity.java 이제
Bundle b = getIntent().getExtras(); // Bundle passed from previous activity to this activity
x = b.getInt("X"); //b is button in previous activity
y = b.getInt("Y"); //b is button in previous activity
xh = b.getInt("XH"); //b is button in previous activity
yh = b.getInt("YH"); //b is button in previous activity
AnimationSet set = new AnimationSet(true);
width = display.getWidth();
height = display.getHeight();
Animation scale = new ScaleAnimation((float)xh/width, 1f, (float)yh/height , 1f, x, y);
Animation alpha = new AlphaAnimation(.75f, 1f);
set.addAnimation(scale);
set.addAnimation(alpha);
set.setDuration(300);
main.startAnimation(set); //main is rootLayout of this activity
Main_Activity (버튼으로 활동)
Bundle bundle = new Bundle();
int[] xy = new int[2];
button.getLocationOnScreen(xy);
bundle.putInt("X", xy[0] + (b.getWidth()/2));
bundle.putInt("Y", xy[1] + (b.getHeight()/2));
bundle.putInt("XH", b.getWidth());
bundle.putInt("YH", b.getHeight());
Intent startnextactivity = new Intent(Table_main.this,Next_Activity.class);
startnextactivity.putExtras(bb);
startActivity(startnextactivity);
(애니메이션 줌 활동)
는 내 질문에 내가이 역 어떻게입니다 생기? 즉, 버튼을 클릭하면 해당 버튼에서 활동이 확대됩니다. 그렇다면 뒤로 버튼을 누를 때 동일한 버튼으로 액티비티를 축소하려면 어떻게해야합니까?@Override
public void onBackPressed()
{
Animation scale = new ScaleAnimation((float)xh/width, 1f, (float)yh/height , 1f, x, y);
// What is the zoom out animation of the above line??
}
나 자신은 밖으로 것을 알 수있다. 하지만 애니메이션 확대/축소는 어떻게 바꿀 수 있습니까? 이 라인의 축소 애니메이션을 알려주시겠습니까 '애니메이션 스케일 = 새로운 ScaleAnimation ((float) xh/width, 1f, (float) yh/height, 1f, x, y); –
@DroidFan ScaleAnimation 생성자의 여섯 인자가 무엇을 가리키는 지 모르겠다. 내가 그랬다면, 나는 너를 도울 수 있을지도 모르지만 지금은 나에게 임의의 숫자이다. – Adam
코드를 다시 살펴보십시오. 나는 활동과 논쟁이 언급하는 것을 게시했다. 내가 할 수 없었던 것은 애니메이션 라인을 뒤집는 것이다. 감사! –