java.lang.StackOverFlow 错误.嫌浏览量太多? [英] java.lang.StackOverFlow error. Suspected too many views?

查看:34
本文介绍了java.lang.StackOverFlow 错误.嫌浏览量太多?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你出现如下错误时(Android 1.5),是因为嵌套的ViewGroups太多,还是因为View的总数太大了?有什么技巧可以在保持应用外观不变的同时绕过它?

When you get an error like the one below (Android 1.5), is it because there are too many nested ViewGroups, or because the total number of Views is too great? Are there any tricks to get around it while still keeping the same look to your app?

java.lang.StackOverflowError
   at android.text.Styled.measureText(Styled.java:371)
   at android.text.Layout.measureText(Layout.java:1600)
   at android.text.Layout.getLineMax(Layout.java:654)
   at android.text.Layout.draw(Layout.java:310)
   at android.text.BoringLayout.draw(BoringLayout.java:356)
   at android.widget.TextView.onDraw(TextView.java:3921)
   at android.view.View.draw(View.java:5838)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.widget.AbsListView.dispatchDraw(AbsListView.java:1319)
   at android.widget.ListView.dispatchDraw(ListView.java:2820)
   at android.view.View.draw(View.java:5944)
   at android.widget.AbsListView.draw(AbsListView.java:2121)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.View.draw(View.java:5841)
   at android.widget.FrameLayout.draw(FrameLayout.java:352)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.View.draw(View.java:5841)
   at android.widget.FrameLayout.draw(FrameLayout.java:352)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.View.draw(View.java:5841)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.View.draw(View.java:5841)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.View.draw(View.java:5841)
   at android.widget.FrameLayout.draw(FrameLayout.java:352)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1486)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.ViewGroup.drawChild(ViewGroup.java:1484)
   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
   at android.view.View.draw(View.java:5841)
   at android.widget.FrameLayout.draw(FrameLayout.java:352)
   at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1847)
   at android.view.ViewRoot.draw(ViewRoot.java:1217)
   at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
   at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:3948)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
   at dalvik.system.NativeStart.main(Native Method)

推荐答案

您有(方式)太多的嵌套布局.您可以在 d.android.com 上查看官方 Android 博客,获取有关如何优化布局的提示和技巧.

You have (way) too many nested layouts. You can check out the official Android blog at d.android.com to get tips and tricks on how to optimize layouts.

这篇关于java.lang.StackOverFlow 错误.嫌浏览量太多?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆