標籤:總結 ges src lin etc public extc cte roi
Hello World!
1.activity_main布局檔案
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent" 5 android:background="#ff0000" 6 android:orientation="horizontal" > 7 8 <TextView 9 android:id="@+id/hello"10 android:layout_width="match_parent"11 android:layout_height="wrap_content"12 android:text="@string/hello_world"13 android:textSize="20sp"14 android:layout_gravity="center"15 android:gravity="center"16 android:textColor="#ff000000"/>17 18 </LinearLayout>
2.MainActivity實現功能
1 package com.helloworld; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 6 public class MainActivity extends Activity { 7 8 @Override 9 protected void onCreate(Bundle savedInstanceState) {10 super.onCreate(savedInstanceState);11 setContentView(R.layout.activity_main);12 }13 }
3.運行效果:
4.學習總結:
Android項目開發,先需要布局好檔案,也就是xml檔案。而後去java中實現準系統,在java中把布局檔案一一對應好。
座右銘:抱怨沒有用,一切靠自己!
Android第一課——HelloWorld