The Android project realizes the splash screen function

Source: Internet
Author: User

Method 1: Write in the main file

1 <span style="font-size:14px; ">  //  cancellation of    title 2this         . Requestwindowfeature ( Window.feature_no_title);     3         // Cancel status bar     4          This . GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,    5                 WindowManager.LayoutParams.FLAG_FULLSCREEN);  </span>  

Method 2: Modify the displayed status in the Androidmanifest.xml configuration file

 1  <span style= " font-size:14px;   " > <activity android:name="  com.example.walkerlogin1.welcomeactivity    2  android:label=  @string/app_name  "  @android: style/theme.black.notitlebar.fullscreen   " 4  > 5  6  </activity></span> 

Specific implementation code

1 Package com.example.walkerlogin1; 2   3   4 import android.app.Activity; 5 import android.content.Intent; 6 import Android.os.Bundle; 7 import android.view.animation.AlphaAnimation; 8 import android.view.animation.Animation; 9 import Android.view.animation.Animation.AnimationListener; Ten import android.widget.RelativeLayout;  One    A    -  Public classWelcomeactivity extends Activity { -    the     protected voidonCreate (Bundle savedinstancestate) { - super.oncreate (savedinstancestate);  -              //Cancel Title -               This. Requestwindowfeature (Window.feature_no_title);  +         //Cancel status bar -             This. GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN);  A Setcontentview (r.layout.activity_welcome);  atRelativelayout layoutwelcome=(relativelayout) Findviewbyid (r.id.activity_welcome);  -Alphaanimation alphaanimation=NewAlphaanimation (0.1f,1.0f);  -Alphaanimation.setduration ( the);  - layoutwelcome.startanimation (alphaanimation);  -Alphaanimation.setanimationlistener (NewAnimationlistener () { -              Public voidOnanimationstart (Animation Animation) { in    -             }         to    +              Public voidonanimationrepeat (Animation Animation) { -    the             }        *    $              Public voidonanimationend (Animation Animation) {Panax NotoginsengSystem. out. println ("Hello");  -Intent intent=NewIntent (welcomeactivity. This, Guideactivity.class);  the startactivity (Intent);  +             }    A         });  the     }   +}



To modify a configuration file:

1<?xml version="1.0"encoding="Utf-8"?>2<manifest xmlns:android="http://schemas.android.com/apk/res/android"  3Package="com.example.walkerlogin1"  4Android:versioncode="1"  5Android:versionname="1.0">6   7<uses-SDK8android:minsdkversion="8"  9android:targetsdkversion=" -"/>Ten    One<Application Aandroid:allowbackup="true"   -android:icon="@drawable/ic_launcher"   -Android:label="@string/app_name"   theAndroid:theme="@style/apptheme"> -          -<activity android:name="com.example.walkerlogin1.MainActivity"   -Android:label="@string/app_name"></activity> +<activity android:name="com.example.walkerlogin1.WelcomeActivity"   -Android:label="@string/app_name"   +Android:theme="@android: Style/theme.black.notitlebar.fullscreen"   A> at<intent-filter> -<action android:name="Android.intent.action.MAIN"/>//Cancel title bar -    -<category android:name="Android.intent.category.LAUNCHER"/> -</intent-filter> -           in</activity> -             to</application> +    -</manifest>


UI Layout Activity_welcome.xml

1<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"  2xmlns:tools="Http://schemas.android.com/tools"  3Android:layout_width="match_parent"  4android:layout_height="match_parent"  5Android:background="@drawable/WELCOME_BG"  6tools:context=". Welcomeactivity"   7Android:id="@+id/activity_welcome">8   9</RelativeLayout>




The Android project realizes the splash screen function

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.