我正在使用第三方工具来创建一个TableView
类似于 iPhone,你可以在这里看到它。
我对这个包做了很多编辑,并增加了一行拥有 EditText 的能力。我在不同的设备上对其进行了测试,效果很好。现在我遇到的问题是,如果我在嵌套布局中有这个 UITableView 并给一行一个编辑文本,当用户在一些旧设备上单击 EditText 时,它会导致堆栈溢出。
这是在一个片段内。结构看起来像这样
(1)(2)(3)(4)RelativeLayout->RelativeLayout->RelativeLayout->ScrollLayout->UITableView
这背后有一些背景,但长话短说我需要所有这些布局,所以删除其中一个不是一种选择。这令人沮丧,就好像我删除了其中一个 RelativeLayouts,应用程序不会崩溃。
android UITableView 也是使用几个 LinearLayouts 设置的。理想情况下,如果我可以将 LinearLayout 设置为能够滚动,那就太好了,这样我就可以删除 ScrollLayout 并且问题就会消失,但遗憾的是我不相信这是可能的。
我得到的错误是
06-13 07:42:23.399: E/AndroidRuntime(1429): FATAL EXCEPTION: main
06-13 07:42:23.399: E/AndroidRuntime(1429): java.lang.StackOverflowError
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2758)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.getChildVisibleRect(ViewGroup.java:2759)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.TextView$HandleView.isPositionVisible(TextView.java:8228)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.TextView$HandleView.moveTo(TextView.java:8245)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.TextView$HandleView.positionAtCursor(TextView.java:8340)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.TextView$InsertionPointCursorController.updatePosition(TextView.java:8401)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.TextView.updateCursorControllerPositions(TextView.java:4292)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.TextView.onDraw(TextView.java:4281)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:6986)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:6989)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:6989)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:7093)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.FrameLayout.draw(FrameLayout.java:361)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.ScrollView.draw(ScrollView.java:1421)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:6989)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:6989)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.View.draw(View.java:6989)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.widget.FrameLayout.draw(FrameLayout.java:361)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1739)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1466)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.ViewGroup.drawChild(ViewGroup.java:1737)
06-13 07:42:23.399: E/AndroidRuntime(1429): at android.view.Vi
我已经在许多较新的设备、Nexus、HTC 等上进行了测试,没有问题。但是,当我在旧设备上测试时,索尼爱立信 Mini Pro 2 会发生此错误。我想确保这个应用程序不会在旧设备上崩溃,目前应用程序支持 2.3.3+
有没有人知道这个递归调用正在发生什么导致旧设备崩溃?有没有办法防止这种情况发生。
任何建议将不胜感激。