添加活动在Eclipse中的Andr​​oid项目的最好方法?方法、项目、Eclipse、Andr

2023-09-11 12:23:23 作者:放肆的依賴

当增加一个活动到现有的Andr​​oid项目,我手动创建一个新的类 - 是最好的/ preferred方式?如何人处理这个问题?

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中在包浏览器。 点击清单编辑器的应用程序选项卡上 单击添加...下的应用程序节点标题(屏幕下方的左) 从列表弹出的对话框中选择活动(如果你有选择,你要创建一个新的顶级元素) 点击在姓名*下的属性头(窗口右下)创建一个类为新的活动链接。

当您在新类对话框中单击完成,它会带你到你的新活动类,就可以开始编码。

When you click Finish from the new class dialog, it'll take you to your new activity class so you can start coding.

五个步骤可能看起来很多,但我只是想成为额外的详细位置,这样很明显。这是pretty的快,当你真正做到这一点。

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.