SlidingMenu和Android-PullToRefresh库冲突



我目前在我的Android项目中使用两个库:

  • SlidingMenu: https://github.com/jfeinstein10/SlidingMenu
  • Android-PullToRefresh: https://github.com/chrisbanes/Android-PullToRefresh

Android 4。x的一切工作正常,但在Android 2。我得到一个StackOverflow异常。

我不确定这是Android版本问题还是硬件问题。

这是异常的日志:

05-22 13:34:30.339: E/AndroidRuntime(15179): java.lang.StackOverflowError
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.text.Styled.measureText(Styled.java:430)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.text.Layout.measureText(Layout.java:1655)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.text.Layout.getLineMax(Layout.java:689)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.text.Layout.draw(Layout.java:340)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.text.BoringLayout.draw(BoringLayout.java:365)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.TextView.onDraw(TextView.java:4259)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6880)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.AbsListView.dispatchDraw(AbsListView.java:1492)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.ListView.dispatchDraw(ListView.java:3138)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6986)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.AbsListView.draw(AbsListView.java:2600)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListView.draw(PullToRefreshListView.java:281)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.buildDrawingCache(View.java:6642)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1259)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1505)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.support.v4.view.ViewPager.draw(ViewPager.java:1574)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at com.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:830)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.view.View.draw(View.java:6883)
05-22 13:34:30.339: E/AndroidRuntime(15179):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
有人能帮我解决这个问题吗?

谢谢!

当你有太多嵌套视图时,你通常会看到这个错误-这个问题在旧版本的Android上加剧。

然而,我也注意到slidingmenu库可以在旧版本的android上导致这个问题。X或更早)。我过去经常看到这个错误,它起源于滑动菜单代码——我自己的视图嵌套深度只有10-15(不是很好,但不是灾难性的)。我切换到菜单抽屉库https://github.com/SimonVT/android-menudrawer,错误消失了。

Things to try…

  1. 启动android设备监视器或层次结构查看器(http://developer.android.com/tools/debugging/debugging-ui.html),看看你的布局。如果有比15-20更深的视图,你可能想要优化你的布局。
  2. 试着把你的滑动菜单库换成谷歌自己的(在支持库中)或我上面提到的(这可能更容易交换,因为它遵循与slidingmenu类似的设计-它花了我大约一个小时)。

祝你好运!

相关内容

  • 没有找到相关文章

最新更新