您的位置:首页 > 编程语言 > Java开发

Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

2016-03-14 13:32 821 查看
NOTE: This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first.

Exception raised during rendering: <include /> can only be used inside of a ViewGroup

Exception details are logged in Window > Show View > Error Log

The following classes could not be instantiated:

- com.wust.widget.PullToRefreshLayout (Open Class, Show Error Log)

See the Error Log (Window > Show View) for more details.

Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F040002.

at android.content.res.BridgeResources.throwException(BridgeResources.java:693)

at android.content.res.BridgeResources.getAnimation(BridgeResources.java:305)

at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:71)

at com.wust.widget.PullToRefreshLayout.initView(PullToRefreshLayout.java:197)

at com.wust.widget.PullToRefreshLayout.<init>(PullToRefreshLayout.java:185)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:442)

at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:194)

at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:206)

at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)

at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:756)

at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:728)

at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:759)

at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)

at android.view.LayoutInflater.rInflate(LayoutInflater.java:728)

at android.view.LayoutInflater.inflate(LayoutInflater.java:492)

at android.view.LayoutInflater.inflate(LayoutInflater.java:373)

不知道这样的问题大家遇到过没有,很烦,找了好多错误没有找到,最后还是加

if(!isInEditMode()){

//造成错误的代码段

}

才能解决问题。

虽然问题解决了,但是我觉得应该不是这样的错误

最开始我一直以为是style的问题,换了好多种都不行,因为在其他的项目中显示的非常正常,就只有style不同
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: