• 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>
  • 相关阅读:
    柳下品茗
    游百花诗意亭有感
    爱情如酒
    笑傲IT文坛
    面对诱惑,你会屈从吗?
    拓展人脉的三十六计
    世界经理人推荐:拓展人脉的两大法宝
    我还能做什么
    诗缘
    有谁陪我风雨同舟
  • 原文地址:https://www.cnblogs.com/alexkn/p/5141893.html
Copyright © 2020-2023  润新知