Eclipse不承认Display对象 [英] Eclipse doesn't recognize Display object

查看:899
本文介绍了Eclipse不承认Display对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我写这篇文章code:

 显示显示= getWindowManager()getDefaultDisplay()。
DisplayMetrics大小=新DisplayMetrics();
显示。

Eclipse不弹出我的显示对象的功能。这表明这些(新,NLS,可运行,的toArray)只有:

我该如何解决?

编辑:
这里是我的进口:

 进口android.util.DisplayMetrics;
进口android.view.Display;
进口android.view.WindowManager;


解决方案

如果你已经更新到的 Eclipse的开普勒最近(或者,即使你没有!),请确保Java的建议下,被选中的Java /编辑/内容辅助/高级

修改:我没有注意到你的code座没有任何方法内只是在你的类的主体。移动到的onCreate()或其它一些生命周期方法,它会工作。

When I write this code:

Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics size = new DisplayMetrics();
display.

Eclipse doesn't pop up the functions of my display object. It shows these (new, nls, runnable, toarray) only:

How can I solve?

EDIT: Here are my imports:

import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

解决方案

If you have updated to Eclipse Kepler recently (or perhaps, even if you haven't!), make sure "Java Proposals" is ticked under "Java/Editor/Content Assist/Advanced"

EDIT: I did not notice that your code block was not within any method and just in the body of your class. Move it into onCreate() or some other lifecycle method and it will work.

这篇关于Eclipse不承认Display对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆