我在我的活动中使用PullToRefresh库。
<com.handmark.pulltorefresh.library.PullToRefreshScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
...
</com.handmark.pulltorefresh.library.PullToRefreshScrollView>
android项目使用19的目标SDK。我启动应用程序,它可以在我的手机上正确运行(Nexus 5,Android 5.0),但它无法在Eclipse中呈现(选择API 19),报告异常:
Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
The following classes could not be instantiated:
- com.handmark.pulltorefresh.library.PullToRefreshScrollView
java.lang.NullPointerException
at com.handmark.pulltorefresh.library.internal.LoadingLayout.<init>(LoadingLayout.java:83)
at com.handmark.pulltorefresh.library.internal.RotateLoadingLayout.<init>(RotateLoadingLayout.java:42)
at com.handmark.pulltorefresh.library.PullToRefreshBase$AnimationStyle.createLoadingLayout(PullToRefreshBase.java:1328)
at com.handmark.pulltorefresh.library.PullToRefreshBase.createLoadingLayout(PullToRefreshBase.java:587)
at com.handmark.pulltorefresh.library.PullToRefreshBase.init(PullToRefreshBase.java:1108)
at com.handmark.pulltorefresh.library.PullToRefreshBase.<init>(PullToRefreshBase.java:113)
at com.handmark.pulltorefresh.library.PullToRefreshScrollView.<init>(PullToRefreshScrollView.java:33)
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:422)
at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
我遇到了第三方视图的一些相关错误,其中只有视图本身未呈现。现在在Eclipse中,不呈现整个布局文件。这使我很难快速调整UI。发生此错误的原因是什么?
答案 0 :(得分:0)
这个问题消失了。我想这是因为我浏览了布局xml文件并使每个元素都正确...