编写第一个Android程序
生活随笔
收集整理的這篇文章主要介紹了
编写第一个Android程序
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Android Studio下載地址:https://dl.google.com/dl/android/studio/install/3.0.0.18/android-studio-ide-171.4408382-windows.exe
JDK下載地址:http://pan.baidu.com/s/1slDN9gh(記得設置Java環境變量,不會就百度)
Android Sdk下載地址:https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip
Android模擬器(在電腦上運行android程序):http://pan.baidu.com/s/1c2Ox22O
啟動AndroidStudio
新建一個項目:
為項目起一個名字:
然后一直點Next,最后點Finish結束。
把gradle版本設置為3.4
接下來開始界面的布局
用線性布局:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><TextView android:layout_width="match_parent"android:layout_height="wrap_content"android:text="Hello,World!"android:textSize="30sp" /> </LinearLayout>
進入MainActivity開始寫程序啟動時要執行的代碼.
onCreate()回掉方法是安卓系統執行這個Activity調用的第一個方法,
所以我們在這里寫最開始要執行的代碼.
運行結果:
總結
以上是生活随笔為你收集整理的编写第一个Android程序的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python实时得到cpu和内存的使用情
- 下一篇: android判断模拟器的三种方法