当我切换两个视图时(同一布局中的Gris视图和列表视图)。我正在做动画切换视图以在LISTVIEW和GRID VIEW中显示数据。它在gridview中正确显示,如果我点击按钮切换LISTVIEW。应用程序崩溃,我得到了以下日志信息。
注意:相同的代码在其他版本中正常运行。即使它只在设备上而不是在模拟器中崩溃。
02-25 14:20:00.859: E/AndroidRuntime(3179): FATAL EXCEPTION: main
02-25 14:20:00.859: E/AndroidRuntime(3179): java.lang.StackOverflowError
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.GLES20Canvas.nGetClipBounds(Native Method)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.GLES20Canvas.getClipBounds(GLES20Canvas.java:471)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.text.Layout.draw(Layout.java:203)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.text.BoringLayout.draw(BoringLayout.java:400)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.widget.TextView.onDraw(TextView.java:5038)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.widget.CompoundButton.onDraw(CompoundButton.java:226)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.draw(View.java:10982)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10421)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.draw(View.java:10985)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10421)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.draw(View.java:10985)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10421)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.draw(View.java:10985)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.widget.FrameLayout.draw(FrameLayout.java:450)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.widget.ScrollView.draw(ScrollView.java:1524)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10421)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.draw(View.java:10985)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10421)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.draw(View.java:10985)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10421)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.View.getDisplayList(View.java:10419)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
02-25 14:20:00.859: E/AndroidRuntime(3179): at android.view.ViewGroup.dispatchDraw(ViewGroup.j
答案 0 :(得分:2)
您的活动的布局层次结构太深,这意味着您在该活动的XML
中有太多布局。我建议您阅读有关如何flatten and optimize布局的内容。
关于这个问题,有很多问题和答案:
java.lang.StackOverFlow error. Suspected too many views?
Stackoverflow: Caused by nested views?