Eclipse 的内容协助在开发 android 时做太多事情

发布于 2024-10-21 16:16:00 字数 166 浏览 10 评论 0原文

我按照谷歌的建议使用 Eclipse 编写 Android 程序。

但是当我写 import android. 时,它自动变成 import android.R.anim;.

我想使用内容辅助,但这种行为很烦人。 我该如何修改它?

I use eclipse to write android programs as advice by google.

But when I write import android. it became import android.R.anim;. automatically.

I would like to use content assist, but this behavior is annoying.
How can I modify it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不语却知心 2024-10-28 16:16:00

编辑:

进入 Eclipse ->首选项

选择 Java ->编辑->内容辅助

在底部“自动激活”框中,取消选中“启用自动激活”复选框,

看看这是否对您有帮助。它将禁用自动填充,您需要按 ctrl+space 才能激活自动填充。

如果这不起作用,那么:

通过使用 Eclipse,我建议不要在导入 Android 特定类的地方编写导入。 Eclipse 足够智能,可以在您需要时建议您需要的类,并自动组织您的导入。

我编写 import 语句的唯一一次是当我导入自己编写的类并且 Eclipse 找不到它们时。

假设您需要 Android 中的 Bitmap 类。

在您的类文件中只需写入:

private Bitmap myBitmap;

Eclipse 将自动建议:

android.graphics.Bitmap

并导入正确的类:

import android.graphics.Bitmap;

EDIT:

Go into Eclipse -> Preferences

Select Java -> Editor -> Content Assist

In the box in the bottom "Auto-Activation", uncheck the checkbox "Enable Auto-Activation"

See if this helps you. It will disabled the auto-fill, and you will need to press ctrl+space to activate the auto-fill.

If this does not work, then:

By using Eclipse I'd recommend not writing imports where you are importing android-specific classes. Eclipse is smart enough to suggest the classes you need when you need them, organizing your imports automatically.

The only time I ever write the import statements is when I'm importing classes that I've written myself and when Eclipse can not find them.

Let's say you need the class Bitmap from Android.

In your class-file just write:

private Bitmap myBitmap;

And Eclipse will automatically suggest:

android.graphics.Bitmap

and import the correct class:

import android.graphics.Bitmap;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文