我有一个包含很多视图的ScrollView,如果我开始活动,我会在滚动后得到这个:
04-10 20:11:42.480: E/AndroidRuntime(2089): FATAL EXCEPTION: main
04-10 20:11:42.480: E/AndroidRuntime(2089): java.lang.StackOverflowError
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.addFocusables(View.java:3654)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:637)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.addFocusables(ViewGroup.java:618)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.getFocusables(View.java:3612)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.FocusFinder.findNextFocus(FocusFinder.java:109)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.FocusFinder.findNextFocus(FocusFinder.java:93)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:476)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.focusSearch(ViewGroup.java:478)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.focusSearch(View.java:3547)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.TextView.onCreateInputConnection(TextView.java:4662)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.inputmethod.InputMethodManager.startInputInner(InputMethodManager.java:945)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.inputmethod.InputMethodManager.checkFocus(InputMethodManager.java:1129)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.inputmethod.InputMethodManager.isActive(InputMethodManager.java:542)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.TextView.onDraw(TextView.java:4173)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.draw(View.java:6933)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.draw(View.java:6936)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.draw(View.java:6936)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.draw(View.java:7039)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.ScrollView.draw(ScrollView.java:1415)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.draw(View.java:6936)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.View.draw(View.java:6936)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-10 20:11:42.480: E/AndroidRuntime(2089): at android.view.ViewGroup.drawChild(
为什么我有这个错误?
答案 0 :(得分:5)
您的UI视图树太深了。 addFocusables
递归(显然)到View
布局树中,Android的堆栈大小相当有限。更改布局以减少嵌套和更多平面布局。您可能需要编写自定义布局以获得所需的布局而无需嵌套。