好的,我正在尝试学习如何开发 Android 应用程序并安装所有相关工具。我还可以访问几本 Android 应用程序开发书籍,遗憾的是这些书籍都是用旧版本的 Eclipse 和 SDK 编写的。
因此,“新 Android 项目”界面有所不同,但我基本上可以绕过这些更改,除了对新空白 Activity 的一些困惑之外。我不确定,但我认为旧版本的 Eclipse/SDK 会创建一个名为 main.xml 的默认 Activity ,尽管我读过的大多数书籍都没有明确说明这一点。另外main.xml的默认内容似乎不同。
这是新的默认代码...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
这就是我认为旧的默认代码的样子......
<?xml version=”1.0” encoding=”utf-8”?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”@string/hello”
/>
</LinearLayout>
我知道这不是一个大的变化,但我检查过的六本书中的大多数教程都失败了(除了默认的“Hello World”教程,我现在已经成功完成了大约 6 次)。
那么任何人都可以给我一些关于在设置新项目时应该做什么以及我应该如何调用新的空白 Activity 的提示,或者是我关于包名称的命名约定的问题。
或者有人可以告诉我如何将 Eclipse/SDK 降级到 Eclipse 3.7.2 版本和 SDK 版本 10 左右,因为大多数书籍似乎都依赖于这些版本。
最佳答案
很难获得旧版本的 SDK,因为每次更新都会做出一些改进。另外我建议您不要降级到旧版本。尝试用谷歌搜索,找出答案并习惯新的方式!新 SDK 中唯一改变的是新项目的创建方式。您可能可以学习有关它的教程,因为其余的事情仍然完全相同。因此,只需在这里或那里点击几下按钮,就没有必要去使用旧的东西。
关于android - 使用 Eclipse 4.2 和 SDK 20 创建新项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12744118/