如何在 Eclipse 中获取 Android API 文档
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5028507/
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
How to get the Android API documentation in Eclipse
提问by Tim
I'd like to be able to integrate Android api docs into Eclipse so that, for example, if hover over an Activity
class you get the appropriate Javadoc in a popup.
我希望能够将 Android api 文档集成到 Eclipse 中,例如,如果将鼠标悬停在一个Activity
类上,您会在弹出窗口中获得适当的 Javadoc。
So to add Javadoc to Android you open up any Android project in Eclipse. Location the "Android x.x" library. In this right click on the android.jarfile and select Properties. Choose the Javadoc location entry.
因此,要将 Javadoc 添加到 Android,您可以在 Eclipse 中打开任何 Android 项目。定位“Android xx”库。在此右键单击android.jar文件并选择 Properties。选择 Javadoc 位置条目。
In the JavadocURL section I entered http://developer.android.com/reference/packages.htmland clicked Validatebut it gives the usual error of
在 JavadocURL 部分,我输入了http://developer.android.com/reference/packages.html并单击了验证,但它给出了通常的错误
Location might be invalid. Files 'package-list' and 'index.html' that are typically available at the root of the documentation created by the Javadoc tool have not been found
位置可能无效。尚未找到通常位于 Javadoc 工具创建的文档根目录中的文件“package-list”和“index.html”
I've tried lots of variations of that URL but to no avail.
我尝试了该 URL 的许多变体,但无济于事。
I also don't want to have to resort to downloading the source for Android.
我也不想求助于下载 Android 的源代码。
采纳答案by Tim
BTW one possible (but unsatisfactory) solution is to get the Honeycomb API docs to access them offline.
In the AVD Manager download the "Documentation for Android 'Honeycomb' Preview SDK" package. This installs into your .../android-sdk-linux_x86/ directory under docs. You can then link the android.jar
file to it as detailed above.
顺便说一句,一种可能(但并不令人满意)的解决方案是让 Honeycomb API 文档离线访问它们。在 AVD 管理器中下载“Android 'Honeycomb' Preview SDK 文档”包。这将安装到 docs 下的 .../android-sdk-linux_x86/ 目录中。然后,您可以将android.jar
文件链接到它,如上所述。
I wouldn't mind being able to download the docs for the particular API version I use but I can't find it anywhere. I'd still prefer to access the online version.
我不介意能够下载我使用的特定 API 版本的文档,但我在任何地方都找不到。我还是更喜欢访问在线版本。
回答by Keith Mattix
In Eclipse right click the Android Library, and hit Configure Build Path. Then Select Android.jar and click Javadoc location. Click Edit then make sure Javadoc URL is selected. In the box, type in: "http://developer.android.com/reference/".
在 Eclipse 中,右键单击 Android 库,然后点击配置构建路径。然后选择 Android.jar 并单击 Javadoc 位置。单击编辑,然后确保选择了 Javadoc URL。在框中,输入:“http://developer.android.com/reference/”。