- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
作为Android四大组件之一,Activity可以说是最基本也是最常见的组件,它提供了一个显示界面,从而实现与用户的交互,作为初学者,必须熟练掌握。今天我们就来通过实验演示,来帮助大家理解Activity的四大启动模式。
演示效果如下:
第一步:实验前准备,相关配置文件以及Activity的建立
(1)AndroidMainfest.xml配置文件
1 ?xml version=1.0 encoding=utf-8? 2 manifest xmlns:android=/apk/res/android
3 package=entflags 4 application
5 android:allowBackup=true
6 android:icon=@mipmap/ic_launcher
7 android:label=@string/app_name
8 android:supportsRtl=true
9 android:theme=@style/AppTheme10 activity android:name=.MainActivity11 intent-filter12 action android:name=ent.action.MAIN /13
14 category android:name=ent.category.LAUNCHER /15 /intent-filter16 /activity17 //另外两个activity18 activity android:name=.Main2Activity /activity19 activity android:name=.Main3Activity/activity20 /application21 /manifest
(2)layout中三个activity的三个布局文件activity_main.xml(这里演示一个,其余两个只是下面TextView文字不一样)
1 ?xml version=1.0 encoding=utf-8? 2 LinearLayout
3 xmlns:android=/apk/res/android
4 xmlns:tools=/tools
5 android:id=@+id/activity_main
6 android:layout_width=match_parent
7 android:layout_height=match_parent
8 android:orientation=vertical
9 tools:context=entflags.MainActivity10 Button
11 android:text=第一个页面
12 android:layout_width=match_parent
13 android:layout_height=wrap_content
14 android:onClick=click1 /15 Button
16 android:text=第二个页面
17 android:layout_width=match_parent
18 android:layout_height=wrap_content
19 android:onClick=click2 /20 Button
21 android:text=第三个页面
22 android:layout_width=match_parent
23 android:layout_height=wrap_content
24 android:onClick=click3 /25 TextView
26 android:layout_width=match_parent
27 android:layout_height=match_parent
28 //其余两个仅文字不一样29 android:text=第一个页面
30 android:textSize=50
文档评论(0)