Android java.lang.StackOverflowError at android.view.ViewGroup.drawChild(ViewGroup.java:2666)

做这样一个页面,下面有五个页签,滑动,有数据显示listview,无数据显示动画,开始我看到他们好多东西是相同的,就提取出来,用include包含布局文件:

结果报一下错误:

01-28 11:27:36.593: E/AndroidRuntime(16182): FATAL EXCEPTION: main

01-28 11:27:36.593: E/AndroidRuntime(16182): java.lang.StackOverflowError

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2666)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.widget.FrameLayout.draw(FrameLayout.java:450)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.widget.ScrollView.draw(ScrollView.java:1939)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.support.v4.view.ViewPager.draw(ViewPager.java:2171)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.draw(View.java:11100)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10536)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2503)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.View.getDisplayList(View.java:10534)

01-28 11:27:36.593: E/AndroidRuntime(16182): at android.view.ViewGroup.drawChild(ViewGroup.java:2864)

开始一直没找到原因,因为没有明确说哪里报错。那个类,那个控件之类的。后来发现是嵌套的层次太深了。一个xml里面包含include,里面的xml还包含include,后台勉为其难,都放到一个xml文件,就ok了!

时间: 2024-10-14 11:26:55

Android java.lang.StackOverflowError at android.view.ViewGroup.drawChild(ViewGroup.java:2666)的相关文章

android布局太深导致的 java.lang.StackOverflowError

E/AndroidRuntime( 1900): java.lang.StackOverflowError E/AndroidRuntime( 1900):     at android.graphics.Canvas.drawText(Canvas.java:1269) E/AndroidRuntime( 1900):     at android.text.Layout.draw(Layout.java:337) E/AndroidRuntime( 1900):     at android

Android慎用layout嵌套, 尽量控制在5层下面java.lang.StackOverflowError

一.探寻原因 在一个复杂的layout嵌套较多layout的android界面.在Android 2.3.内存较低 的机型上,出现 java.lang.StackOverflowError 这个Exception,appcrash退出. 这个错误出现的比較奇怪,在我做技术调研的时候,这个界面是放在4.0的系统中測试,工作非常正常,没有出现这个严重错误. android SDK中对该错误的出现的场景描写叙述为:因为栈调用的层次太多.超过了虚拟器dalvik的最大限制(作为一个虚拟器參数,可定制)导

java.lang.NoSuchMethodException: [class android.view.View]

05-24 11:38:35.884: E/AndroidRuntime(1819): FATAL EXCEPTION: main05-24 11:38:35.884: E/AndroidRuntime(1819): Process: com.example.activitytest, PID: 181905-24 11:38:35.884: E/AndroidRuntime(1819): java.lang.IllegalStateException: Could not find a met

Android 执行 gson.toJson(object) 报java.lang.StackOverflowError异常

如下面的代码,执行后报java.lang.StackOverflowError错误: MusicSavedInfo musicSavedInfo=new MusicSavedInfo(currentStartTime,openOrCloseFlag,currentDayFlags,currentSelectMusicTitle,currentSelectMusicPath,"1"); String jsonData=gson.toJson(musicSavedInfo); 我手机4.1

android——fragment长时间home或者锁屏java.lang.IllegalArgumentException:No view found for id for....

在项目中遇到了这个问题.头痛了很久,总是无法重现,也不能很好的解决.总是在息屏后一段时间,就会报java.lang.IllegalArgumentException:No view found for id for....的问题,然后程序就崩溃了.相信很多朋友也有和我一样遇到这个问题的.那么这个问题怎么去解决呢? 在仔细研究fragment的manager后,下面是我发现的东西 什么鬼?怎么会有两个fragmentManager.这两个东西有什么关系呢? API上面说了一大堆,我这里简单总结一下

Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPointerException 错误的集中原因及解决办法

上面那个问题刚解决,就又来一个问题~~~~ 错误信息字符串:java.lang.RuntimeException: Unable to start activity ComponentInfo{...}: java.lang.NullPointerException 网上有不少解决办法 一般都会在Activity  onCreate()方法里的setContentView(XXX)发生此错误,网上查阅了很多原因,大概有四种重要可能的原因: 原因一:xxx的错误,若为R.layout.main 

很急!!! java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley

============问题描述============ 日志文件如下,不知道是什么原因报如下错误 08-01 16:33:35.001: E/AndroidRuntime(31240): FATAL EXCEPTION: main 08-01 16:33:35.001: E/AndroidRuntime(31240): Process: cn.phonecms.main, PID: 31240 08-01 16:33:35.001: E/AndroidRuntime(31240): java.

异常:java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley

原因:http://m.blog.csdn.net/blog/Melody8869/46908891 java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley导致这种异常有以下几种原因: 1.adt版本问题,更新adt版本 2.jar包问题,其原因也是adt引起,只需删除libs下下的无用jar(我的v4包问题,delete) 或者: 没有将需要导入的包复制到项目的libs文件夹中.

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0解决办法

androidstudio编译程序时出现java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0.Unsupported major.minor version 52.这个错误是由于(jdk)高版本的java project使用了低版本的来运行.使用命令(java -version 和 javac -version)查看java