我有一个文本视图,我想在其中设置文本,但是当我在android API 4.0.3中运行应用程序时,它会因堆栈溢出而崩溃,但是当我删除行setText时,它可以正常工作。
java.lang.StackOverflowError
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.graphics.Paint.getTextRunAdvances(Paint.java:1664)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.text.TextLine.handleText(TextLine.java:745)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.text.TextLine.handleRun(TextLine.java:972)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.text.TextLine.drawRun(TextLine.java:397)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.text.TextLine.draw(TextLine.java:199)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.text.Layout.draw(Layout.java:432)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.widget.TextView.onDraw(TextView.java:5274)
11-25 19:02:15.787 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11014)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.797 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.807 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.817 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.817 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.817 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.827 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.837 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.837 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.widget.FrameLayout.draw(FrameLayout.java:450)
11-25 19:02:15.837 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.widget.ScrollView.draw(ScrollView.java:1535)
11-25 19:02:15.837 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.837 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.837 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.847 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at com.sothree.slidinguppanel.SlidingUpPanelLayout.drawChild(SlidingUpPanelLayout.java:1190)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at com.sothree.slidinguppanel.SlidingUpPanelLayout.draw(SlidingUpPanelLayout.java:1243)
11-25 19:02:15.857 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1089)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.widget.FrameLayout.draw(FrameLayout.java:450)
11-25 19:02:15.867 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.support.v7.internal.widget.ActionBarOverlayLayout.draw(ActionBarOverlayLayout.java:500)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.877 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10442)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.drawChild(ViewGroup.java:3149)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2788)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.draw(View.java:11017)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.widget.FrameLayout.draw(FrameLayout.java:450)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2175)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.View.getDisplayList(View.java:10444)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:883)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewRootImpl.draw(ViewRootImpl.java:2089)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1781)
11-25 19:02:15.887 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2666)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.os.Looper.loop(Looper.java:156)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:4977)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-25 19:02:15.897 30304-30304/ir.navaar.android.debug W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
和我的textview:
<TextView
android:id="@+id/lay_itempage_ratingnum_txtvu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/lay_item_page_rating_indicator_linlay"
android:layout_centerHorizontal="true"
android:layout_marginBottom="4dp"
android:maxLines="1"
android:textColor="#ccc" />
答案 0 :(得分:0)
当代码进入无限循环时,通常会出现堆栈溢出错误。也许,您要在某个$FXCopTypes=@('batch','component','web')
或for(...)
周期内设置文字。