Androidstudio production Welcome screen and app icon

Source: Internet
Author: User

Objective

Hello everyone, to bring you AndroidStudio制作欢迎界面与应用图标 an overview, I hope you like

Welcome screen and App icon

This project uses Android Studio 3.0.1 as a development tool

Activity_splash.xml

Created a activity_splash.xml layout file for the Welcome interface layout, first modified to Relativelayout layout

<?xml version="1.0" encoding="utf-8"?><!--添加一张欢迎界面的背景--><RelativeLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width = "match_parent"    android:layout_height="match_parent"    android:background="@drawable/launch_bg">    <!--显示版本号-->    <TextView        android:id="@+id/tv_version"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:textColor="@android:color/white"        android:textSize="14sp"        android:layout_centerInParent="true"/></RelativeLayout>
Splashactivity.java

Create Splashactivity.java class, welcome interface implementation Class

Package Cn.edu.gdmec.android.androidstudiodemo;import Android.content.intent;import Android.content.pm.activityinfo;import Android.content.pm.packageinfo;import Android.content.pm.PackageManager; Import Android.os.bundle;import Android.support.v7.app.appcompatactivity;import Android.widget.textview;import Java.util.timer;import Java.util.timertask;public class Splashactivity extends appcompatactivity{@Override protecte        d void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);        Setcontentview (R.layout.activity_splash);        Set this interface for//vertical screen setrequestedorientation (activityinfo.screen_orientation_portrait);    Init ();        } private void Init () {TextView tv_version = Findviewbyid (r.id.tv_version);            try {packageinfo packageinfo = Getpackagemanager (). Getpackageinfo (Getpackagename (), 0);        Tv_version.settext ("version:" +packageinfo.versionname); } catch (Packagemanager.namenotfoundexception E) {e.printstacktrace ();        Tv_version.settext ("version");        }//Using a timer to allow this interface to jump after 3 seconds, the timer has a thread that continuously executes the task Timer timer = new timer (); TimerTask timertask = new TimerTask () {@Override public void run () {//Send intent Implement page jump                Turn, the first parameter is the context of the current page, the second parameter is the home page to jump Intent Intent = new Intent (splashactivity.this,mainactivity.class);                StartActivity (Intent);            After jumping off the current Welcome page SplashActivity.this.finish ();        }        };    Schedule execution TimerTask, second parameter incoming delay time (MS) Timer.schedule (timertask,3000); }}
Androidmanifest.xml

Configure the Welcome interface in the manifest file Androidmanifest.xml, modify the application portal to the Welcome screen, and then remove the ActionBar effect

<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/ Android "package=" Cn.edu.gdmec.android.androidstudiodemo "> <!--originally android:theme=" @style/apptheme "-< !--Remove Actionbar title bar-<!--add app icon,app_icon--> <application android:allowbackup= "true" Androi        d:icon= "@drawable/app_icon" android:label= "@string/app_name" android:roundicon= "@mipmap/ic_launcher_round" Android:supportsrtl= "true" android:theme= "@style/theme.appcompat.noactionbar" > <activity Android : Name= ". Splashactivity "> <intent-filter> <action android:name=" Android.intent.action.MAIN "/        > <category android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> <!--Add implementing Class--<activity android:name= ". Mainactivity "></activity> </application></manifEst> 
Add

The production process is like a background image to join, you can find the relevant pictures to join or DIY alone. Mainactivity.java and Activity_main.xml have not made any changes.

Summarize
    • This article speaks of the Androidstudio production welcome interface and app icon, if you have a better understanding, welcome to communicate
    • Positioning: Sharing Android & Java knowledge points, interested to continue to follow

Androidstudio production Welcome screen and app icon

Related Article

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.