2011-11-23 51 views
3

我已經得到了與修改baseadapterr的列表視圖加載到列表項的圖片。當您點擊該項目時,它會更改活動的主要內容。現在我時不時的應用程序可能是因爲如果這個活動。對情侶手機和一切在ListView的StackOverflow - Android的

java.lang.StackOverflowError 
at android.widget.TextView.onDraw(TextView.java:4329) 
at android.view.View.draw(View.java:6993) 
at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
at android.view.View.draw(View.java:6996) 
at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
at android.view.View.draw(View.java:6996) 
at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
at android.view.View.draw(View.java:6996) 
at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
at android.view.View.draw(View.java:6996) 
at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1499) 
at android.widget.ListView.dispatchDraw(ListView.java:3194) 
at android.view.View.draw(View.java:6996) 
at android.widget.AbsListView.draw(AbsListView.java:2607) 
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:6996) 
at android.view.ViewGroup.drawChild(ViewGroup.java:1732) 
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) 
at android.view.View.draw(View.java:6996) 
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:6996) 
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:6996) 
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:6996) 
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:6996) 
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:6996) 
at android.widget.FrameLayout.draw(FrameLayout.java:357) 
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2054) 
at android.view.ViewRoot.draw(ViewRoot.java:1632) 
at android.view.ViewRoot.performTraversals(ViewRoot.java:1335) 
at android.view.ViewRoot.handleMessage(ViewRoot.java:1991) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:150) 
at android.app.ActivityThread.main(ActivityThread.java:4358) 
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:849) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) 
at dalvik.system.NativeStart.main(Native Method) 

應用測試是罰款英國,但它在美國墜毀幾乎總是。列表項中的圖片是Facebook個人資料圖片。

回答

6

您活動的用戶界面太複雜。你有太多ViewGroups堅持其他ViewGroups。將您的應用程序置於仿真器中,並使用層次結構視圖(Eclipse透視圖或獨立工具)來檢查此活動的視圖層次結構。你會發現,從根到最遠葉,你有15層以上的層次,這是太多。找到方法將其切換回更少的層,例如用單個RelativeLayout替換嵌套的LinearLayout小部件。

+0

謝謝,我會試試看。但是我想知道更糟糕的是什麼?每個項目或主要層中有多個圖層?我會嘗試擺脫LinearLayout並將其替換爲RelativeLayout,就像您所說的那樣。 – goodm