为了账号安全,请及时绑定邮箱和手机立即绑定

Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup

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

The following classes could not be instantiated:

- com.example.stock.slidingmenu.view.SlidingMenu (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


java.lang.NullPointerException

    at com.example.stock.slidingmenu.view.SlidingMenu.<init>(SlidingMenu.java:41)

    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:739)

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

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

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

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


正在回答

4 回答

你好,我看了你完整的log;建议先解决Exception raised during rendering: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup 。 下面有几种可能的情况:1、是否在项目结构中建立了无关的文件夹;2、资源的名称命名是否合法;3、详细检查下布局文件,看看有没有在某个View里面写了子View,比如你会不会把LinearLayout写成了某个View,或者自定义ViewGroup是否继承自ViewGroup。

2 回复 有任何疑惑可以回复我~
#1

BB_0012

厉害厉害!
2016-03-28 回复 有任何疑惑可以回复我~
我用百分比布局也出现这个错误  再别的项目中是可以的   因为引入了SlidingMenu和ActionSherkLock,之后就不行了。。


0 回复 有任何疑惑可以回复我~

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 (Open Class, Show Error Log)


0 回复 有任何疑惑可以回复我~

小伙伴,你的问题解决了吗?我的也出现这个问题了,我是用的com.handmark.pulltorefresh.library.PullToRefreshScrollView,这个。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
QQ5.0侧滑菜单
  • 参与学习       62531    人
  • 解答问题       295    个

本教程将带领大家通过自定义控件实现QQ5.0侧滑菜单

进入课程
意见反馈 帮助中心 APP下载
官方微信