Best way to add Activity to an Android project in Eclipse?(在 Eclipse 中将 Activity 添加到 Android 项目的最佳方法?)
问题描述
向现有 Android 项目添加活动时,我手动创建了一个新类 - 这是最好/首选的方式吗?其他人是怎么处理的?
When adding an activity to an existing Android project, I manually create a new class - is that the best / preferred way? How do others handle that?
推荐答案
您可以使用新建类"对话框,但需要手动执行其他步骤(例如,向清单文件添加条目).如果您希望这些步骤自动化,您可以通过清单编辑器创建活动,如下所示:
You can use the "New Class" dialog, but that leaves other steps you need to do by hand (e.g. adding an entry to the manifest file). If you want those steps to be automated, you can create the activity via the manifest editor like this:
- 在包资源管理器中双击 AndroidManifest.xml.
- 点击清单编辑器的应用程序"标签
- 点击应用程序节点"标题下的添加.."(屏幕左下角)
- 从弹出的对话框中的列表中选择 Activity(如果有选项,您想创建一个新的顶级元素)
- 点击属性"标题下的名称*"链接(窗口右下角)为新活动创建一个类.
当您从新课程对话框中单击完成"时,它将带您进入新的活动课程,以便您开始编码.
When you click Finish from the new class dialog, it'll take you to your new activity class so you can start coding.
五个步骤可能看起来很多,但我只是想在这里更加详细,以便清楚.实际操作时非常快.
Five steps might seem a lot, but I'm just trying to be extra detailed here so that it's clear. It's pretty quick when you actually do it.
这篇关于在 Eclipse 中将 Activity 添加到 Android 项目的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Eclipse 中将 Activity 添加到 Android 项目的最佳方法?


- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01