Android First Lesson--helloworld

Source: Internet
Author: User

Hello world!

1.activity_main Layout file

1<?xml version= "1.0" encoding= "Utf-8"?>2<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"3Android:layout_width= "Match_parent"4android:layout_height= "Match_parent"5Android:background= "#ff0000"6android:orientation= "Horizontal" >7     8<TextView9Android:id= "@+id/hello"TenAndroid:layout_width= "Match_parent" Oneandroid:layout_height= "Wrap_content" Aandroid:text= "@string/hello_world" -Android:textsize= "20SP" -android:layout_gravity= "Center" theandroid:gravity= "Center" -Android:textcolor= "#ff000000"/> -  -</LinearLayout>
2.MainActivity Implementation Capabilities

1  PackageCom.helloworld;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 6  Public classMainactivityextendsActivity {7 8 @Override9     protected voidonCreate (Bundle savedinstancestate) {Ten         Super. OnCreate (savedinstancestate); One Setcontentview (r.layout.activity_main); A     } -}

3. Operating effect:


4. Learning Summary:
Android project Development, the first need to layout a good file, that is, XML files. Then go to Java to implement the basic functions, in Java, the layout file one by one corresponds well.
Motto: No use complaining, all on your own!

Android First Lesson--helloworld

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.