Android (2)

來源:互聯網
上載者:User

標籤:android   java   ext   使用   檔案   類   

1.一個activity就是一個類,extends Activity
2.必須overwrite onCreate方法.因為第一次運行app時,app的第一個activity顯示在手機上的時候,調用的就是該activity的onCreate方法,由android作業系統架構調用
3.因為每一個activity是一個應用程式組件,需要在AndroidManifest.xml中註冊。設定檔中所有xml屬性的值都是R.java中已經註冊的索引值對得鍵。
4.為activity添加必要的控制項,寫在layout目錄下的xml檔案中,控制項加布局
5.usually,一個activity對應一個layout下的xml檔案,便於管理
(類似於一個developer有一套struts-config,sqlmap,applicationContext的xml檔案)
6.在layout下配置好了各個控制項之後,在activity的onCreate方法中使用findViewById方法擷取控制項

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.