The import android. App. *;
The import android. OS. *;
The import android. View. *;
The import android. View. Animation. *;
Public class MainActivity extends the Activity
{
/* * Called when the activity is first created. */
@ Override
Public void onCreate (Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//Set the main XML as the user interface layout
The setContentView (R.l ayout. Main);
}
/* * Called when the new exit button is clicked. */
Public void onExitButtonClick View (View)
{
finish();
}
/* * Called when the new drop button is clicked. */
Public void onDropButtonClick View (View)
{
//Do some fancy animation...
TranslateAnimation animation=new TranslateAnimation (0, 0, 0, 1000);
Animation. SetDuration (1000);
The startAnimation (animation);
/*
TranslateAnimation animation=new TranslateAnimation (0, 0, 0, 1000);
Animation. SetDuration (1000);
The startAnimation (animation);
*/
//and how does the three lines of code above?
}
Public void onAppButtonClick View (View)
{
}
}
CodePudding user response:
There was a row above comments in English, would you want to perform some animation,CodePudding user response:
The first line tells you what the animation, the next action painting how long it will take to perform the third line view began to perform in the animationCodePudding user response:
You this is the value of animationThe first line: these values are animated objects pass parameters are variable parameters, now you are using a mobile animation, after the first two parameters is the top left corner coordinates, two parameters are the lower right corner coordinates
The second line: the duration of the animation
The third line: through the view of start animation method start animation