Eclipse-创建新活动

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11576813/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:38:30  来源:igfitidea点击:

Eclipse- creating new Activity

androideclipseandroid-activityadt

提问by user1540293

I have problem when I create a new Android project. I fill in the name of the app and the package name, then I go to the next scrren and set the icon. On the following scrren I select Blank activityand hit nextwhen this screen appears:

创建新的 Android 项目时遇到问题。我填写应用程序名称和包名称,然后我转到下一个屏幕并设置图标。在以下屏幕上,我选择空白活动并在出现此屏幕时点击下一步

Eclipse create activity dialog

Eclipse 创建活动对话框

I enter everything, but i don? know what to do with Hierarchical Parent. A few days ago it worked perfectly, but now when I chose something from list on the left, and create activity, eclipse unless I wrote something says it's wrong.

我输入了所有内容,但我不输入?知道如何处理Hierarchical Parent。几天前它工作得很好,但是现在当我从左边的列表中选择一些东西并创建活动时,eclipse 除非我写了一些东西说它是错误的。

Can anyone help me?

谁能帮我?

回答by Chilledrat

For an Activityset it to android.app.activity.

对于将其Activity设置为 android.app.activity。

回答by Kenrick

I got the same problem like yours. After a day, I found the way.

我遇到了和你一样的问题。一天后,我找到了路。

It's very simple. re install the ADT Plugin: In Eclipse, Help > Install New Software.... Click Add, in the top-right corner. Enter "ADT Plugin" for the Name and URL = http://dl-ssl.google.com/android/eclipse/Then just enter until finish

这很简单。重新安装 ADT 插件:在 Eclipse 中,帮助 > 安装新软件...。单击右上角的添加。输入“ADT 插件”作为名称和 URL = http://dl-ssl.google.com/android/eclipse/然后输入直到完成

For the full tutorial how to instal ADT Plugin you can look at: http://developer.android.com/sdk/installing/installing-adt.html

有关如何安装 ADT 插件的完整教程,您可以查看:http: //developer.android.com/sdk/installing/installing-adt.html

回答by ITForHumanity

Platform-tools version 14 has this problem, but not version 13.

Platform-tools 版本 14 有这个问题,但版本 13 没有。

http://dl-ssl.google.com/android/repository/platform-tools_r13-linux.zip

http://dl-ssl.google.com/android/repository/platform-tools_r13-linux.zip

I backed up my current (problematic) /android-sdk/platform tools, deleted the old folder and replaced it with ver 13, started eclipse, reset the android-sdk path (windows>preferences>android, don't forget to click "apply") and recreated my AVD.

我备份了我当前的(有问题的)/android-sdk/platform 工具,删除了旧文件夹并将其替换为 ver 13,启动 eclipse,重置 android-sdk 路径(windows>preferences>android,不要忘记点击“ apply") 并重新创建了我的 AVD。

Version 13 also has the heirarchical parent text box, but it's optional.

版本 13 也有分层父文本框,但它是可选的。

回答by paiego

The problem is a bug with the Application Wizard... which triesto integrate the Activity Wizard within itself. The problem is that the integrated Activity Wizard doesn't work correctly without there being an existing project.

问题是应用程序向导的一个错误...它试图将活动向导集成到自身中。问题是集成的活动向导在没有现有项目的情况下无法正常工作。

Therefore, an easy solution to this problem is from the Project Wizard, just create a basic main activity with "none" for navigation type and click "finish". Then once the project has been created, use the Activity Wizard to create your desired main Activity.

因此,这个问题的一个简单解决方案是从项目向导中,只需创建一个导航类型为“无”的基本主要活动,然后单击“完成”。然后,一旦创建了项目,就可以使用活动向导创建所需的主活动。

As a bonus, the Activity Wizard will even refactor the code to use this new Activity as your main Activity!

作为奖励,活动向导甚至会重构代码以使用这个新活动作为您的主要活动!

回答by AITAALI_ABDERRAHMANE

Your error concerns the name of the activity verify the project build sdk

您的错误涉及活动名称验证项目构建 sdk

the hierarchical parent activity is used normally to provide a default implementation for the UP button

分层父活动通常用于为 UP 按钮提供默认实现

回答by gary

1.Copy your Package Name, then past to "Hierarchical Parent" Field. (any words to skip this step)

1.复制您的包名称,然后粘贴到“Hierarchical Parent”字段。(任何话跳过这一步)

2.AndroidManifest.xml need an "android.intent.action.MAIN" for start. Add follow source code

2.AndroidManifest.xml 需要一个“android.intent.action.MAIN”来启动。添加关注源代码

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

like this:

像这样:

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>