安卓基础

  • [onCreate(Bundle)] is where you initialize your activity.

Most importantly, here you will usually call `[setContentView(int)] with a layout resource defining your UI

and using [findViewById(int)] to retrieve the widgets in that UI that you need to interact with programmatically.

  • [onPause()] is where you deal with the user pausing active interaction with the activity. Any changes made by the user should at this point be committed (usually to the [ContentProvider](https://developer.android.com/reference/android/content/ContentProvider) holding the data). In this state the activity is still visible on screen.

访问资源:
当 Android 应用程序被编译,生成一个 R 类,其中包含了所有 res/ 目录下资源的 ID。你可以使用 R 类,通过子类+资源名或者直接使用资源 ID 来访问资源。
https://www.runoob.com/android/android-resources.html

R.layout.activity_main引用自res/layout目录下的activity_main.xml文件。onCreate()是活动被加载之后众多被调用的方法之一。

各种文件说明:
https://www.runoob.com/android/android-hello-world-example.html

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android: 五种布局: FrameLayout 、 LinearLayout 、 AbsoluteLayou...
    神奇的小蘑菇阅读 3,502评论 0 2
  • 本文是我学习安卓的笔记的一部分,查看详细完整笔记请参阅 活动 ** 基本用法** 活动简介包含界面用于交互程序中包...
    小白猿阅读 2,817评论 0 1
  • 本文是我学习安卓的笔记的一部分,查看详细完整笔记请参阅 简介 fragment中文译为碎片,可以嵌入活动中,让程序...
    小白猿阅读 3,517评论 0 0
  • 晴空万里白云浮, 微风渐去炎热出; 不知酷暑何时消, 满城清凉炎热无。
    好郝说话阅读 2,607评论 0 2
  • 当你感到疲倦时,你会怎么办呢?当你做事乏力时,你会怎么办呢?当你情绪不对时,你会怎么办呢?...... 通过跑步,...
    伏晶之心阅读 1,742评论 0 0