Android HelloWorld

1.先上效果图(代码地址github:https://github.com/BruceAnda/Day01_HelloWorld)

Android HelloWorld_第1张图片

2.布局文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
    android:layout_width="match_parent"    
    android:layout_height="match_parent"    
    android:orientation="vertical">    
        
        <TextView    
        android:layout_width="match_parent"    
        android:layout_height="50dp"    
        android:background="#987"    
        android:gravity="center"    
        android:text="Android第一个程序"    
        android:textSize="22sp" />  
          
        <LinearLayout    
        android:layout_width="match_parent"    
        android:layout_height="match_parent"    
        android:gravity="center">    
           
            <TextView    
            android:layout_width="match_parent"    
            android:layout_height="wrap_content"    
            android:gravity="center"    
            android:text="Android 第一个程序" />    
        </LinearLayout>     
</LinearLayout>

3.Java代码

package com.ztjc.day01_helloworld;    
import android.app.Activity;    
import android.os.Bundle;    
/**    
 * Android第一个程序HelloWorld    
 */    
public class MainActivity extends Activity {  
  
    @Override    
    protected void onCreate(Bundle savedInstanceState) {    
        super.onCreate(savedInstanceState);    
        setContentView(R.layout.activity_main);    
    }    
}


你可能感兴趣的:(android)