自定义视图在Eclipse中UI设计师没有preVIEW [英] No preview of custom views on UI designer in Eclipse

查看:373
本文介绍了自定义视图在Eclipse中UI设计师没有preVIEW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创造了许多类型的自定义视图,通常我得到显示出其previews对ADT的UI设计师就好了。

I've been creating many types of custom views, and normally i get their previews shown just fine on the UI designer of ADT.

最近,更新的ADT(22.0.5.v201307292155--757759)的最新版本后,我看不到任何类型的自定义视图,而不是连最简单的。

lately, after updating to the newest version of the ADT ( 22.0.5.v201307292155--757759 ), i can't see any type of custom view, not even the simplest one .

现在,我知道肯定自定义视图可以previewed罚款,因为如果我创建了一个新的工作区和创建它们,我可以看到他们就好了。

now, i know for sure that custom views can be previewed fine , since if i create a new workspace and create them, i can see them just fine.

问题是,在当前的工作空间,这对于其项目有很多设置,我不断收到此错误:

the problem is that on the current workspace, which has many settings for its projects, i keep getting this error:

以下类找不到:
   - ...(更改为...,修复构建路径,编辑XML,创建类)

The following classes could not be found: - ... (Change to ... , Fix Build Path, Edit XML, Create Class)

其中...是类的自定义视图中。

where "..." is the class of the custom view.

我也得到一个灰色的矩形,因为我使用的每个自定义视图,并林特也抱怨:

i also get a gray rectangle for each custom view i use, and Lint also complains:

在布局文件中引用类,...,未在项目中找到
  或库

Class referenced in the layout file, ..., was not found in the project or the libraries

这是很奇怪的,因为我使用了正确的语法在XML中自定义视图(我已经做了很多)。甚至一拖&放;下降并没有帮助

this is very weird, since i used the correct syntax for the custom views in the XML (and i've done it a lot). even drag&drop didn't help.

这也是奇怪,因为日食可以找到类(使用CTRL +点击XML标记去正确的正确的类),它只是似乎没有找到他们,而观看。

it's also weird because eclipse can find the classes (using CTRL+click on the XML tag goes right to the correct class) , it just doesn't seem to find them while viewing.

我也试着卸载ADT并重新安装它,但它并没有帮助。我也一直在努力,卸载并从SDK管理器重新安装一些相关的组件。没有任何帮助。

i've also tried to uninstall ADT and reinstall it, but it didn't help. i've also tried to uninstall and re-install some relevant components from the SDK manager. nothing helped.

这里有一个自定义视图的样本code,它根本不显示好:

here's a sample code of a custom view that doesn't show well at all :

public class CustomTextView extends TextView {

    public CustomTextView(Context context) {
        super(context);
    }

    public CustomTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }
}

你可以看到,没有什么特别在这个code。

as you can see, there is nothing special in this code.

为什么会出现这种问题?如何解决呢?我可以或许复制所有的(我的意思是所有)当前工作区到一个新的设置来解决呢?

Why does it occur? how can i fix it? can i perhaps copy all (and i mean all) the settings of the current workspace to a new one to solve it?

别人是否有这个问题?它是一个ADT错误吗?

Does anybody else have this problem? is it an ADT bug?

请注意:我并不想重置工作区。它在它的项目太多特殊的设置。

NOTE: I do not want to reset the workspace. it has far too many special settings for the projects within it.

推荐答案

你也一起ADT更新Eclipse插件?

Did you also update the Eclipse plugin together with the ADT?

我知道这发生在我身上,一旦这很可能是我错过了。

I know this happened to me once it was probably what i missed.

也许,如果有更新的实际平台SDK的更新它们。你也可以尝试改变preVIEW使用到最新或SDK版本较早的企业之一(这是在preVIEW左上角应该说18 android的图标)。

Maybe if there are updates to the actual platform SDK's update them as well. you can also try to change the version of the SDK the preview uses to the latest or earlier one (this is the android icon on the top left in the preview which should say 18).

我知道,如果你在文本中使用阴影例如一些自定义视图不渲染。然后,你刚才设置的isInEditMode标志自定义视图里面跳过这些。

I know that some custom views don't render if you use shadows for example on text. Then you just set the isInEditMode flag inside the custom view to skip those.

在最后重新下载一个新的拉链与ADT包和尝试:)

At the very end download a new zip with the ADT bundle and try again :)

希望这有助于以某种方式。

Hope this helps somehow.

这篇关于自定义视图在Eclipse中UI设计师没有preVIEW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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