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

来源:互联网 发布:网络服务器机柜 品牌 编辑:程序博客网 时间:2024/04/28 11:45
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不同

0 1
原创粉丝点击