Just learn Android app development friends, may encounter a problem, is someone else's app just enter will have a page appear a moment after disappear, this page can be used to advertise, can also declare the theme of the app, so say this launch page is very important, next, I'm sharing my code with you. Remember that this activity is to be declared as the main page in Androidmanifest.xml, which is <activity
Android:name= "Com.gp.acitivity.AppStart" >
<!--set the program that starts first, and to start which activity, copy the following code to the specified location--
<intent-filter>
<action android:name= "Android.intent.action.MAIN"/>
<category android:name= "Android.intent.category.LAUNCHER"/>
</intent-filter>
</activity> inflate () or can be understood as "hidden expansion", hidden in view, inflate () just get control, but no size does not occupy space in the view, inflate () after a certain size, Just out of the hidden state. As for this alphaanimation is a transparent animation effect, 0.3f to 1.0f is transparent degree, the effect is certainly better than 0.5f to 1.0f effect
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);就是设置持续时间,就是这个Page How long do you want to make it disappear? The following Onanimationend method is what to do after the animation page ends. We're just going to add a Redirectto method to make the animation jump to another page. My blog will be updated occasionally oh, like I pay attention to me, I am the great god of Android, we will see you next time.
About the Android App launcher interface