Android学习笔记(一)

今天第一天学习android,通过mars的视频的,总体上学起来感觉还不错,还是能够快的接受mars老师的思想的。

今天主要学习了android的工程的建立,各个目录的功能。

主要的技术上的东西学了activity:

建立activity,主要包括几步:创建继承于Activity类的类,覆写oncreate()方法;在AndroidMainfest.xml中注册;建立相应的在layout中布局文件.xml;

多个activity通过intent交互,对于Intent有Compenent Name,Action, Data和Extra(键值);

几个比较常用的控件:EditText、TextView、Button和Menu,其中Menu的添加相对于其他三个由所有不同,通过在Activity中覆写父类的OnCreateOptionMenu()

对于事件的响应采用监听器的方式,使用匿名类;

Activity的生命周期,主要是对7个函数的了解



onCreate():Called when the activity is first created;

onStart():Called when the activity is becoming visible to the user;

onResume():Called when the activity will start interacting with the user(也即获得焦点时);

onPause():Called when the system is about to start resuming a previous activity;(失去焦点时)

onStop():Called when the activity is no longer visible to the user;

onRestart():Called after your activity has been stopped, prior to it being started again.;

onDestroy():The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish()on it, or because the system is temporarily destroying this instance of the activity to save space;

例子注意对话框的区别:对话框的弹出就是让之前的Activity失去焦点,但是是可见的,就执行到OnPause()这一步。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值