Develop a new Android interface, interface jump See graphic android---Android Development example tutorial three or four

Source: Internet
Author: User

Android Instance Illustration Tutorial Directory

http://blog.csdn.net/wyx100/article/details/45061407

I. Course functions

This course tells you to create a new interface and interface switch (from interface to interface).

Two. Course interface

Interface One (Start interface)

Interface two (main interface)

Three. Work flow

2 procedures are required to complete a page switchover:

1. Establish a project, see section Ii.

http://blog.csdn.net/wyx100/article/details/45248209

Development can be continued on the basis of the project.

2. Setting up the Boot interface

First introduce the resource picture

Creating an XML file for the boot interface layout

Edit the Start.xml file to introduce the layout

Edit the Start.xml file and introduce the picture view (the view that holds the picture, Images Vies)

Introducing Pictures

Interface One (Start interface)

Start.xml File Source code

<?xml version= "1.0" encoding= "UTF-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:layout_width=" fill_parent "    android:layout_height=" fill_parent "    android:o rientation= "vertical" >    <imageview        android:id= "@+id/imageview1" android:layout_width= "Fill_        Parent "        android:layout_height=" fill_parent "        android:src=" @drawable/bg "/></linearlayout>

3. Writing the Java class for the boot interface

Startactivity.java

Three seconds after the boot screen, jump to the main interface, the page jumps by intent completed.

Package Com.example.helloword;import Android.app.activity;import Android.content.intent;import android.os.Bundle; Import Android.os.handler;import Android.widget.imageview;public class StartActivity extends Activity {/** called when The activity is first created. */private final int splash_display_lenght = 3000; Delay three seconds   @Overridepublic void OnCreate (Bundle savedinstancestate) {    super.oncreate (savedinstancestate);    Setcontentview (R.layout.start);    New Handler (). postdelayed (New Runnable () {               @Override public         void Run () {             Intent mainintent = new Intent ( Startactivity.this,mainactivity.class);             StartActivity.this.startActivity (mainintent);             StartActivity.this.finish ();         }                   }, Splash_display_lenght); }}
Interface switching

Main code

      new Handler (). postdelayed (New Runnable () {                  @Override          public void Run () {& nbsp;            Intent mainintent = new Intent ( Startactivity.this,mainactivity.class); Interface Jump Definition              StartActivity.this.startActivity (mainintent); Start interface Jump              StartActivity.this.finish (); After the interface jump is complete, remove interface one         }                     }, Splash_display_lenght); The interface shows the length of   

4. Modify the Boot profile (Androidmanifest.xml) to start from the Start screen, enter the Start screen, will automatically execute the Java code of the Boot interface, complete the interface switch.

Androidmanifest.xml

<?xml version= "1.0" encoding= "Utf-8"? ><manifest xmlns:android= "http://schemas.android.com/apk/res/        Android "package=" Com.example.helloword "android:versioncode=" 1 "android:versionname=" 1.0 "> <uses-sdk android:minsdkversion= "8" android:targetsdkversion= "/> <application android:allowbackup=" True "android:icon=" @drawable/ic_launcher "android:label=" @string/app_name "android:theme=" @style/app Theme "> <activity android:name=" com.example.helloword.StartActivity "android:label=" @s Tring/app_name "> <intent-filter> <action android:name=" Android.intent.action.MAIN "        /> <category android:name= "Android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name= ". Mainactivity "/> </application></manifest>

5. Complete the project and start running. How to run, see section Two, the first Android project.

Develop a new Android interface, interface jump See graphic android---Android Development example tutorial three or four

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.