首学开发

新建一个Activity2类:

package com.hanqi.test;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

/**
 * Created by Administrator on 2016/3/16.
 */
public class Activity2 extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity2);
         System.out.println("这是我运行的第一个activity");
        Log.d("text", "log输出的信息");

        Log.e("text","log输出的信息");

        Log.w("text","log输出的信息");

        Log.i("text","log输出的信息");

        Log.v("text","log输出的信息");


    }
}

新建一个layout xmt file文件:加入一个文本“大家好”

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"

        android:text="大家好"

        />


</LinearLayout>

运行之后会在虚拟机上显示:

后台显示如下:颜色不同代表提示程度不一样,红色是最高级

原文地址:https://www.cnblogs.com/fangchongyan/p/5356623.html