运用软件
AndroidStudio
配置环境
java环境
创建程序
1、创建project:File 文件> New > New Project > Andriod > Andriod Project
2、填入信息:
Application Name:这个映用的名字,加载在Andriod设备中,图标上显示的映用名称。
conmpay domain
projectlocation 用户名及环境目录
3、设定运行环境信息
minimum SDK路径 建议4.0以上
4、选择样式图
完成
创建一个程序
manifests 里的AndroidManifest.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.example.chenshuai.test"> 4 5 <application 6 android:allowBackup="true" 7 android:icon="@mipmap/ic_launcher" 8 android:label="@string/app_name" 9 android:supportsRtl="true" 10 android:theme="@style/AppTheme"> 11 <!--谁在前启动谁--> 12 <activity android:name=".Axtivity2"> 13 <intent-filter> 14 <action android:name="android.intent.action.MAIN" /> 15 16 <category android:name="android.intent.category.LAUNCHER" /> 17 </intent-filter> 18 19 20 </activity> 21 22 <activity android:name=".MainActivity"> 23 <intent-filter> 24 <action android:name="android.intent.action.MAIN" /> 25 26 <category android:name="android.intent.category.LAUNCHER" /> 27 </intent-filter> 28 </activity> 29 30 31 </application> 32 33 </manifest>
res 里面 layout里的activity_main.xml
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:weightSum="1"> 6 7 <!--匹配父窗口 match_parent 8 包裹内容 wrap_content--> 9 <TextClock 10 android:layout_width="wrap_content" 11 android:layout_height="wrap_content" 12 13 android:text="大家好" 14 15 16 /> 17 18 </LinearLayout>
java
1 package com.example.chenshuai.test; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.util.Log; 6 7 /** 8 * Created by chenshuai on 2016/3/16. 9 */ 10 public class Axtivity2 extends Activity { 11 12 13 @Override 14 protected void onCreate(Bundle savedInstanceState) { 15 16 super.onCreate(savedInstanceState); 17 18 setContentView(R.layout.layoutactivity); 19 20 System.out.println("这是我运行的第一个Activity"); 21 22 //输出日志 23 Log.d("test","Log输出的信息"); 24 25 Log.w("test","Log输出的信息");//warning 蓝色 26 27 Log.e("test","Log输出的信息");//eror 红色 28 29 Log.i("test","Log输出的信息"); 30 31 Log.v("test","Log输出的信息");