我创建了一个非常复杂的应用程序。主类是tabhost
,其中包含3个其他tabhosts
作为小部件。一些tabwidgets包含listviews
,其中一个列表导致stackoverflow错误出现问题。
但这种错误只发生在姜饼上(不是在所有设备上)。我真的不知道如何摆脱这个错误。
在此之前,linearlayouts
中的每个项目都有3-4 listview
,但现在我取而代之的是relativelayout
。这有帮助,但只有一段时间。
一个应用程序如何正常工作,另一个应用程序可能会不断崩溃?
java.lang.StackOverflowError
at android.widget.TextView.onDraw(TextView.java:4321)
at android.view.View.draw(View.java:6970)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.view.View.buildDrawingCache(View.java:6695)
at android.view.View.getDrawingCache(View.java:6475)
at android.view.ViewGroup.drawChild(ViewGroup.java:1657)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480)
at android.widget.ListView.dispatchDraw(ListView.java:3193)
at android.view.View.draw(View.java:6973)
at android.widget.AbsListView.draw(AbsListView.java:2588)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
at android.view.View.draw(View.java:6973)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1961)
at android.view.ViewRoot.draw(ViewRoot.java:1600)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1321)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1957)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4263)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:1)
我在ListView中使用像bellow布局一样的行有同样的问题:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFE60000">
<TextView android:id="@+id/header_category_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Category goes here..."
android:padding="1dp"
style="@style/offers_group_category">
</TextView>
</FrameLayout>
<FrameLayout android:id="@+id/container_flipper"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ViewFlipper android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</ViewFlipper>
</FrameLayout>
<LinearLayout
android:id="@+id/container_dots"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="2dp"
android:gravity="center"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/im_dot_full"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/im_dot_empty"
/>
</LinearLayout>
正如你所看到的,我在FrameLayout中有一个ViewFlipper,这在我测试它的几乎所有设备中都很好用,但它在HTC Wildfire S中崩溃了(所有带Ghingerbread的手机)。所以在我的情况下,解决方案是从FrameLayout中取出ViewFlipper。 希望它会对你有所帮助。
答案 1 :(得分:0)
从堆栈跟踪看来,某些代码块以递归方式调用android.view.View.draw
方法,请发布您的代码以获取更多详细信息