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