筆記 day 1

i.o.t. internet of Thing 物聯網

APP無專利~可複製

download  Android studio

> APP→
> choose Device > ...> your virtual devices> +Create Virtual Device
> Select Hardware > Category"Phone "; Name"3.2"QVGA(ADP2)3.2 320*480 mdpi
> Next


Nexus 5API 21x86 + create virtual device Next
Lollipop 22x86 Android
AVD name  A-Z 0-9皆可
Show Memory RAM:512 設定最小 跑比較快
Use same device for future


Widgets 添加元件
Ab textView
Plain TextView
OK Button 按鈕
Plain text 輸入文字

Properties 屬性設定
Layout: alignParentStart
設定id = 程式名 /Text= 呈現文字

Plain TextView 可加入文字

ok Button 按鈕

RelativeLayoutEnd
Ab textview 文字視窗 須改 去 properties 更改id 及text


Android
APP
  manifests 設定檔
  java 程式檔
  res 預設文字 圖片設定
  layout 圖形介面
  每個頁面都是一個View
  import 匯入

-----
MainActivity.Java程式碼 →package
activity-main.xml元件設計

import內建程式
public class 主程式
     MainActivity extends Activity {
Protected void  onCreate 預設程式   表示一個function
   layout 圖型介面

}

-----

出現紅字! 表程式有錯

Relative layout 必須都有一個獨立id
表示結束,結尾必加 " 分號 ; "

public class 表主程式

宣告變數打在這裡

@override 表覆蓋之意,此程式建立在基本設定之上
protected void onCreate (Bundle savedInstanceState){

內容程式打在這裡
}
#在layout會出現你設定好的文字
!切記 預設須在程式碼調整為UTF-8,才能看到中文字,而不會有亂碼。
(1)TextView + xxxx-name (取一個新名字 ) 給他一個變數
! 切記 不可與id一樣,宣告變數 只能是文字
按下 alt+enter 會出現下拉式選單,可匯入預設的程式檔,用tab鍵選取library程式
import android.widget.TextView;

(2)xxxx-name=(TextView)findViewById(R.id.xxxxname);
                           內建程式名                   R指resource

(3)xxxx-name.setText("打入你想要呈現的文字");
                       連接屬性    

#輸入文字後,會出現其他文字
(4)string strNAME宣告變數

(5) strNAME=ed-Input.getText().toString();

(6) str_ id.setText(strNAME)


若原程式暫時不用,但想保留,可在程式前加//,會變成備註。



留言

這個網誌中的熱門文章

N1 文法 I

速食熱量一覽表

水星文化 Mercury's Culture