Add a welcome page to Android

Source: Internet
Author: User

There will be a welcome page for a few seconds before you enter the software, such as:

This requires two activity mates:

Welcomeactivity and mainactity;

Also need to pay attention to the more software entry interface, that is, change the value in the Androidmainmanifest.

Here is the code in Androidmainmanifest:

<activity            android:name= "com.jerehedu.headline.WelcomeActivity"            android:label= "@ String/title_activity_welcome ">            <intent-filter>                <action android:name=" Android.intent.action.MAIN "/>                <category android:name=" Android.intent.category.LAUNCHER "/>            < /intent-filter>        </activity>        <activity            android:name= " Com.jerehedu.headline.MainActivity "            android:label=" @string/app_name ">        </activity >

Then there is the OnCreate method in Welcomeactivity:

protected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Requestwindowfeature (window.feature_no_title);//This sentence means to delete the default titlebar Setcontentview (R.layout.activity_welcome); NewHandler (). postdelayed (NewRunnable () {//here is equivalent to the first parameter of handler @Override Public voidrun () {Intent mainintent=NewIntent (welcomeactivity. This, Mainactivity.class); Welcomeactivity. This. StartActivity (mainintent); Welcomeactivity. This. Finish (); }                              }, 1000); Here, 1000 means 1000 milliseconds, or 1 seconds.

Welcomeactivity XML is the imageview you need to make a welcome page;

Then the mainactivity is your own code.

Add a welcome page to Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.