Android入门篇1-Hello World

一.android studio安装.

二.项目结构

三.运行流程

src->main->AndroidMainifest.xml注册HelloWorldActivity(intent-filter中设置为主活动)->src->main->java->HelloWorldActivity.java(setContentView设置布局)->src->main->res->layout->activity_hello_world.xml

四.创建流程

1.在src->main->res->layout中创建一个resource file,比如是third_layout.xml.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:id="@+id/button_3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button 3"
        />


</LinearLayout>

2.src->main->java->com.addict.activitytest中创建一个activity,比如是ThirdActivity

package com.addict.activitytest;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

public class ThirdActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.third_layout);
    }
}

3.在AndroidManifest.xml上给activity注册.

<activity android:name=".ThirdActivity" >
      <intent-filter>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:scheme="http" />
      </intent-filter>
</activity>

 

posted @ 2016-01-19 22:13  李雷雷alexkn  阅读(236)  评论(0编辑  收藏  举报