Android APP startup Interface
If you are new to Android App development, you may encounter a problem, that is, when someone else's App first enters a page that disappears after a while, this page can be used for advertising, you can also declare the topic of the App, so this launch page is crucial. Next, I will share my code with you to remember that this activity should be stored in Androidmanifest. the declaration in xml is the main page, that is, the <activity
Android: name = "com. gp. acitivity. AppStart">
<! -- Set the program to be started first. Copy the following code to the specified position for the Activity to be started -->
<Intent-filter>
<Action android: name = "android. intent. action. MAIN"/>
<Category android: name = "android. intent. category. LAUNCHER"/>
</Intent-filter>
</Activity> Inflate () can be understood as "implicit expansion", which is placed in the view implicitly. Before inflate (), only the control is obtained, but no size is occupied by the View space, inflate () has a certain size, just out of the hidden state. as for this AlphaAnimation is a transparent animation, 0.3f to 1.0f is transparent, and the effect is certainly better than 0.5f to 1.0f.
public class AppStart extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final View view = View.inflate(this, R.layout.start, null); setContentView(view);
AlphaAnimation aa = new AlphaAnimation(0.3f,1.0f); aa.setDuration(2000); view.startAnimation(aa); aa.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation arg0) { redirectTo(); } @Override public void onAnimationRepeat(Animation animation) {} @Override public void onAnimationStart(Animation animation) {} }); private void redirectTo(){ Intent intent = new Intent(this, Main.class); startActivity(intent); finish(); }} aa.setDuration(2000); That is, set the duration.How long does the page disappear after it appears? The onAnimationEnd method of the rewrite below is what it will do after the animation page ends. We will add a redirectTo method here to jump to another page after the animation ends. My blog will be updated occasionally. If you like it, follow me. I am a great android player, we will see you later.