0

我面临堆栈溢出错误。我在 3 个选项卡中使用此布局,前 2 个选项卡是活动,它没有显示任何错误,但第三个选项卡显示错误。

我用作标签活动的第三个标签

这是我的日志:

10-03 10:42:14.090: E/AndroidRuntime(302): FATAL EXCEPTION: main
10-03 10:42:14.090: E/AndroidRuntime(302): java.lang.StackOverflowError
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.text.Styled.drawUniformRun(Styled.java:61)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.text.Styled.drawDirectionalRun(Styled.java:298)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.text.Styled.drawText(Styled.java:357)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.text.Layout.drawText(Layout.java:1387)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.text.Layout.draw(Layout.java:370)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.text.BoringLayout.draw(BoringLayout.java:365)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.TextView.onDraw(TextView.java:4050)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6740)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.AbsListView.dispatchDraw(AbsListView.java:1365)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.ListView.dispatchDraw(ListView.java:3046)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6846)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.AbsListView.draw(AbsListView.java:2257)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.View.draw(View.java:6743)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.widget.FrameLayout.draw(FrameLayout.java:352)
10-03 10:42:14.090: E/AndroidRuntime(302):  at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewRoot.draw(ViewRoot.java:1407)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
10-03 10:42:14.090: E/AndroidRuntime(302):  at android.os.Handler.dispatchMessage(Handl

这是我的布局

  1.     <RatingBar
            android:id="@+id/imageView2"
            style="@style/foodRatingBar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="2dp"
            android:visibility="invisible" />
    
        <Button
            android:id="@+id/button2"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="45dp"
            android:layout_height="35dp"
            android:background="@drawable/setting_btn" />
    
    </LinearLayout>
    
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/frame"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:text="Mary Smith"
        android:textColor="#585858"
        android:textSize="16dp"
        android:textStyle="bold" />
    
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/textView1"
        android:layout_alignBottom="@+id/textView1"
        android:layout_marginLeft="5dp"
        android:layout_toRightOf="@+id/textView1"
        android:text="asks:"
        android:textColor="#a6a6a6"
        android:textSize="15dp" />
    
    <FrameLayout
        android:id="@+id/frameLayout1"
        android:layout_width="fill_parent"
        android:layout_height="20dp"
        android:layout_below="@+id/textView3"
        android:layout_marginLeft="15dp"
        android:layout_marginTop="10dp"
        android:layout_toLeftOf="@+id/textView5"
        android:layout_toRightOf="@+id/button5" >
    </FrameLayout>
    
    <Button
        android:id="@+id/button8"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="90dp"
        android:layout_height="25dp"
        android:layout_alignRight="@+id/editText1"
        android:layout_below="@+id/editText1"
        android:layout_marginTop="5dp"
        android:background="@drawable/vote_btnimg" />
    
    <ImageView
        android:id="@+id/button5"
        android:layout_width="60dp"
        android:layout_height="55dp"
        android:layout_alignTop="@+id/frameLayout1"
        android:scaleType="fitCenter"
        android:layout_marginLeft="5dp" />
    
    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="60dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/button5"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="25dp"
        android:background="@drawable/ask_question_box"
        android:gravity="top"
        android:hint="Add your comment here"
        android:imeOptions="actionDone"
        android:inputType="textMultiLine"
        android:maxLines="10"
        android:paddingLeft="10dp"
        android:paddingTop="8dp"
        android:singleLine="false"
        android:textColor="#d5d5d5"
        android:textSize="12dp" />
    
    <Button
        android:id="@+id/button3"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/editText1"
        android:layout_alignTop="@+id/textView2"
        android:visibility="visible"
        android:background="@drawable/report_btn" />
    
    <ToggleButton
        android:id="@+id/imageView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/button3"
        android:layout_alignBottom="@+id/button3"
        android:layout_toLeftOf="@+id/button3"
        android:background="@drawable/follower_toggle"
        android:button="@null"
        android:soundEffectsEnabled="true"
        android:textOff=""
        android:visibility="invisible"
        android:textOn="" />
    
    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/button5"
        android:layout_alignLeft="@+id/frameLayout1"
        android:background="@drawable/button_selecter_yes" />
    

        <ListView
            android:id="@+id/listview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/imageView2"
            android:layout_marginTop="18dp"
            android:divider="@null"
            android:dividerHeight="0dp"
            android:fadingEdgeLength="0dp" >
        </ListView>
    </RelativeLayout> -->
    
    <!-- <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_alignTop="@+id/button8"
        android:text="Rate this Question :"
        android:textColor="#000000"
        android:visibility="invisible"
        android:textSize="12dp" /> -->
    
    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_alignRight="@+id/button3"
        android:layout_below="@+id/button3"
        android:text="which shirt is sutable for me"
        android:textColor="#999999"
        android:textSize="15dp" />
    
    <ProgressBar
        android:id="@+id/imageView7"
        style="@style/CustomProgressBar"
        android:layout_width="150dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button4"
        android:layout_alignRight="@+id/button7"
        android:layout_alignTop="@+id/button5" />
    
    -->
    <Button
        android:id="@+id/button6"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_alignBaseline="@+id/button4"
        android:layout_alignBottom="@+id/button4"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@+id/button4"
        android:background="@drawable/button_selecter_no" />
    
    <Button
        android:id="@+id/button7"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/editText1"
        android:layout_alignRight="@+id/editText1"
        android:layout_alignTop="@+id/button6"
        android:background="@drawable/skip" />
    
    <TextView
        android:id="@+id/textView6"
        android:layout_width="40dp"
        android:layout_height="17dp"
        android:layout_alignBaseline="@+id/textView5"
        android:layout_alignBottom="@+id/textView5"
        android:layout_alignParentRight="true"
        android:text="100%"
        android:textColor="#000000"
        android:textSize="10dp"
        android:textStyle="bold" />
    
    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_below="@+id/button5"
        android:clickable="true"
        android:text="Enlarge"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#000000"
        android:textSize="13dp" />
    
    <ListView
        android:id="@+id/listview"
        android:layout_below="@+id/button8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:fadingEdgeLength="0dp" >
    </ListView>
    
    <TextView
        android:id="@+id/textView5"
        android:layout_width="40dp"
        android:layout_height="17dp"
        android:layout_above="@+id/button4"
        android:layout_toRightOf="@+id/textView1"
        android:text="100%"
        android:textColor="#000000"
        android:textSize="10dp"
        android:textStyle="bold" />
    

4

2 回答 2

1

在相对布局内的某个地方,视图依赖关系可能存在一个循环。我可以看到frameLayout1视图依赖于button5,这也button5依赖于framelayout1.

这会创建一个可能导致您的问题的循环,因为 android 尝试解决并将视图放置在屏幕上并陷入这种无限循环的依赖关系。请仔细检查并优先使用视图创建器进行相对布局,而不是手动输入

于 2013-10-05T20:53:01.373 回答
0

检查您的可绘制图像大小..
图像大小可能是堆栈溢出的原因。
尝试使用小尺寸的图像.....

于 2013-10-05T12:24:11.527 回答