Step-by-step diagram to develop the first Android project and run the See graphics Android---Android Development example tutorial two

Source: Internet
Author: User

I. Build an Android App project

1. Running Eclipse.exe

2. See

3. Enter the interface

4. Enter the app, project, package name

5. Select the workspace path that the project establishes;

6. Configure features such as icons and backgrounds

7. Select the Activity's page format

8. Set the corresponding name

9. Build the Project

Two. Project Introduction

1. The interface can use the tool to drag the control by dragging. Graphical interface development environment.

2. Code format for interface layout

3.mainactivity.java main program structure code and view bindings

3. Code Mainactivity.java

Package Com.example.helloworld;import Android.os.bundle;import Android.app.activity;import android.view.Menu; public class Mainactivity extends Activity {    @Override    protected void onCreate (Bundle savedinstancestate) {        super.oncreate (savedinstancestate);        Setcontentview (R.layout.activity_main);    }    @Override Public    Boolean oncreateoptionsmenu (Menu menu) {        //Inflate the menu, this adds items to the Action bar I F it is present.        Getmenuinflater (). Inflate (R.menu.main, menu);        return true;    }    }

4. Code Activity_main.xml

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android"    xmlns:tools= "http// Schemas.android.com/tools "    android:layout_width=" match_parent "    android:layout_height=" Match_parent "    android:paddingbottom= "@dimen/activity_vertical_margin"    android:paddingleft= "@dimen/activity_ Horizontal_margin "    android:paddingright=" @dimen/activity_horizontal_margin "    android:paddingtop=" @dimen /activity_vertical_margin "    tools:context=". Mainactivity ">    <textview        android:layout_width=" wrap_content "        android:layout_height=" Wrap_ Content "        android:text=" @string/hello_world "/></relativelayout>

5. Code Main.xml

<menu xmlns:android= "Http://schemas.android.com/apk/res/android" >    <item        android:id= "@+id/ Action_settings "        android:orderincategory=" "        android:showasaction=" never "        android:title=" @string /action_settings "/></menu>
Three. Project Operation

1. Run the project

2. Start the ADT Simulator, Android phone simulation software. After running, automatically start ADT

3. Run the interface

4. Click Configure Run interface

Step-by-step diagram to develop the first Android project and run the See graphics Android---Android Development example tutorial two

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.